mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[breaking change] CellSwipe: rename to SwipeCell (#1652)
This commit is contained in:
parent
7f00320e1f
commit
e6cc4eab03
@ -22,7 +22,7 @@
|
||||
**Improvements**
|
||||
|
||||
- Button: add warning type [\#1558](https://github.com/youzan/vant/pull/1558)
|
||||
- CellSwipe: add open method [\#1546](https://github.com/youzan/vant/pull/1546)
|
||||
- SwipeCell: add open method [\#1546](https://github.com/youzan/vant/pull/1546)
|
||||
- DatetimePicker: support minute range [\#1583](https://github.com/youzan/vant/pull/1583)
|
||||
- Icon: add size prop [\#1555](https://github.com/youzan/vant/pull/1555)
|
||||
- Stepper: update disabled color [\#1560](https://github.com/youzan/vant/pull/1560)
|
||||
@ -393,7 +393,7 @@
|
||||
|
||||
* fix NavBar title max width limitation [\#867](https://github.com/youzan/vant/pull/867)
|
||||
* fix Button vertical align incorrect when loading [\#858](https://github.com/youzan/vant/pull/858)
|
||||
* fix CellSwipe should only trigger swipe when drag horizontally [\#866](https://github.com/youzan/vant/pull/866)
|
||||
* fix SwipeCell should only trigger swipe when drag horizontally [\#866](https://github.com/youzan/vant/pull/866)
|
||||
* fix ImagePreview manually close not work [\#864](https://github.com/youzan/vant/pull/864)
|
||||
* fix SubmitBar inherit wrong font size [\#857](https://github.com/youzan/vant/pull/857)
|
||||
* fix SwitchCell text vertical align [\#852](https://github.com/youzan/vant/pull/852)
|
||||
@ -477,7 +477,7 @@
|
||||
**Improvements**
|
||||
|
||||
* AddressEdit: add show-delete prop [\#716](https://github.com/youzan/vant/pull/716)
|
||||
* CellSwipe: optimzie animation fluency [\#685](https://github.com/youzan/vant/pull/685)
|
||||
* SwipeCell: optimzie animation fluency [\#685](https://github.com/youzan/vant/pull/685)
|
||||
* Field: support autosize maxHeight & minHeight [\#718](https://github.com/youzan/vant/pull/718)
|
||||
* Locale: optimize i18n config [\#701](https://github.com/youzan/vant/pull/701)
|
||||
* PullRefresh: support trigger loading animation [\#684](https://github.com/youzan/vant/pull/684)
|
||||
@ -895,7 +895,7 @@
|
||||
|
||||
**Improvements**
|
||||
|
||||
* CellSwipe: add onClose prop, support async controll [\#356](https://github.com/youzan/vant/pull/356)
|
||||
* SwipeCell: add onClose prop, support async controll [\#356](https://github.com/youzan/vant/pull/356)
|
||||
* Uploader: support inherit attrs [\#357](https://github.com/youzan/vant/pull/357)
|
||||
* optimize local compile speed [\#355](https://github.com/youzan/vant/pull/355)
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
**Breaking changes**
|
||||
|
||||
- CellSwipe 滑动单元格 可以实现点击一个按钮,多个cellswip向右滑动吗? [\#1538](https://github.com/youzan/vant/issues/1538)
|
||||
- SwipeCell 滑动单元格 可以实现点击一个按钮,多个cellswip向右滑动吗? [\#1538](https://github.com/youzan/vant/issues/1538)
|
||||
- 日期控件(datetimepicker)可以对时分设置范围 [\#1531](https://github.com/youzan/vant/issues/1531)
|
||||
- Tab 组件 sticky 增加一个 距离顶部的高度功能 [\#1504](https://github.com/youzan/vant/issues/1504)
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
- stepper 步进器 点击加号 减号也有点击反馈 [\#1599](https://github.com/youzan/vant/issues/1599)
|
||||
- upload到底怎么使用啊,怎么把得到的参数替换掉默认图片的路径呢? [\#1596](https://github.com/youzan/vant/issues/1596)
|
||||
- ImagePreview最新版本预览图片报错 [\#1595](https://github.com/youzan/vant/issues/1595)
|
||||
- CellSwipe 左滑,right 有 edit delete 两个按钮的时候,如何判断点击的是哪个呢? [\#1593](https://github.com/youzan/vant/issues/1593)
|
||||
- SwipeCell 左滑,right 有 edit delete 两个按钮的时候,如何判断点击的是哪个呢? [\#1593](https://github.com/youzan/vant/issues/1593)
|
||||
- 商品规格弹层控件中如果设置none\_sku: true,加入购物车时还提示“选择规格” [\#1588](https://github.com/youzan/vant/issues/1588)
|
||||
- Low android version compatibility issues [\#1585](https://github.com/youzan/vant/issues/1585)
|
||||
- vant collapse使用报错 [\#1584](https://github.com/youzan/vant/issues/1584)
|
||||
@ -80,7 +80,7 @@
|
||||
- npm install 下来的css,里边有的icon font文件,是cdn引用的,而不是本地的。 [\#1552](https://github.com/youzan/vant/issues/1552)
|
||||
- DatetimePicker 中能否加上年月日上午/下午 [\#1551](https://github.com/youzan/vant/issues/1551)
|
||||
- 手机滚动不流畅啊?没有个scroll-content? [\#1549](https://github.com/youzan/vant/issues/1549)
|
||||
- CellSwipe 滑动单元格如何确定当前数据条目? [\#1548](https://github.com/youzan/vant/issues/1548)
|
||||
- SwipeCell 滑动单元格如何确定当前数据条目? [\#1548](https://github.com/youzan/vant/issues/1548)
|
||||
- 怎么修改弹出层样式 [\#1547](https://github.com/youzan/vant/issues/1547)
|
||||
- popup 组件中 lock-scroll 功能 在 ios 中失效 [\#1544](https://github.com/youzan/vant/issues/1544)
|
||||
- 以$toast、$dialog 形式调用 toast和dialog在prod环境莫名undefined [\#1542](https://github.com/youzan/vant/issues/1542)
|
||||
@ -119,7 +119,7 @@
|
||||
- \[Improvement\] Button: add warning type [\#1558](https://github.com/youzan/vant/pull/1558) ([chenjiahan](https://github.com/chenjiahan))
|
||||
- \[Improvement\] Icon: add size prop [\#1555](https://github.com/youzan/vant/pull/1555) ([chenjiahan](https://github.com/chenjiahan))
|
||||
- \[Doc\] update detail [\#1554](https://github.com/youzan/vant/pull/1554) ([chenjiahan](https://github.com/chenjiahan))
|
||||
- \[Improvement\] CellSwipe: add open method [\#1546](https://github.com/youzan/vant/pull/1546) ([chenjiahan](https://github.com/chenjiahan))
|
||||
- \[Improvement\] SwipeCell: add open method [\#1546](https://github.com/youzan/vant/pull/1546) ([chenjiahan](https://github.com/chenjiahan))
|
||||
- \[bugfix\] Button: text-size-adjust [\#1545](https://github.com/youzan/vant/pull/1545) ([chenjiahan](https://github.com/chenjiahan))
|
||||
- \[bugfix\] Stepper: optimize input strategy [\#1534](https://github.com/youzan/vant/pull/1534) ([chenjiahan](https://github.com/chenjiahan))
|
||||
- \[Doc\] Dialog: update usage [\#1520](https://github.com/youzan/vant/pull/1520) ([chenjiahan](https://github.com/chenjiahan))
|
||||
|
@ -22,7 +22,7 @@
|
||||
**Improvements**
|
||||
|
||||
- Button: 新增 warning 类型 [\#1558](https://github.com/youzan/vant/pull/1558)
|
||||
- CellSwipe: 新增 open 方法 [\#1546](https://github.com/youzan/vant/pull/1546)
|
||||
- SwipeCell: 新增 open 方法 [\#1546](https://github.com/youzan/vant/pull/1546)
|
||||
- DatetimePicker: 支持限制分钟范围 [\#1583](https://github.com/youzan/vant/pull/1583)
|
||||
- Icon: 新增 size 属性 [\#1555](https://github.com/youzan/vant/pull/1555)
|
||||
- Stepper: 优化禁用态样式 [\#1560](https://github.com/youzan/vant/pull/1560)
|
||||
@ -387,7 +387,7 @@
|
||||
|
||||
- 修复 NavBar 标题长度未限制的问题 [\#867](https://github.com/youzan/vant/pull/867)
|
||||
- 修复 Button loading 状态下无法水平对齐的问题 [\#858](https://github.com/youzan/vant/pull/858)
|
||||
- 修复 CellSwipe 在垂直滑动时也会触发 Swipe 的问题 [\#866](https://github.com/youzan/vant/pull/866)
|
||||
- 修复 SwipeCell 在垂直滑动时也会触发 Swipe 的问题 [\#866](https://github.com/youzan/vant/pull/866)
|
||||
- 修复 ImagePreview close 方法失效的问题 [\#864](https://github.com/youzan/vant/pull/864)
|
||||
- 修复 SubmitBar 字体大小继承错误的问题 [\#857](https://github.com/youzan/vant/pull/857)
|
||||
- 修复 SwitchCell 文字未垂直居中的问题 [\#852](https://github.com/youzan/vant/pull/852)
|
||||
@ -469,7 +469,7 @@
|
||||
**Improvements**
|
||||
|
||||
* AddressEdit: 新增 show-delete 属性 [\#716](https://github.com/youzan/vant/pull/716)
|
||||
* CellSwipe: 优化 Swipe 动画流畅度 [\#685](https://github.com/youzan/vant/pull/685)
|
||||
* SwipeCell: 优化 Swipe 动画流畅度 [\#685](https://github.com/youzan/vant/pull/685)
|
||||
* Field: 支持配置 autosize 最大/最小高度 [\#718](https://github.com/youzan/vant/pull/718)
|
||||
* Locale: 精简 i18n 配置文档 [\#701](https://github.com/youzan/vant/pull/701)
|
||||
* PullRefresh: 支持手动触发 loading 动画 [\#684](https://github.com/youzan/vant/pull/684)
|
||||
@ -886,7 +886,7 @@
|
||||
|
||||
**Improvements**
|
||||
|
||||
* CellSwipe: 新增 onClose 属性,支持异步控制 [\#356](https://github.com/youzan/vant/pull/356)
|
||||
* SwipeCell: 新增 onClose 属性,支持异步控制 [\#356](https://github.com/youzan/vant/pull/356)
|
||||
* Uploader: 支持继承原生属性 [\#357](https://github.com/youzan/vant/pull/357)
|
||||
* 优化本地构建速度 [\#355](https://github.com/youzan/vant/pull/355)
|
||||
|
||||
@ -1273,7 +1273,7 @@
|
||||
* 新增 CellSwitch 组件 [\#95](https://github.com/youzan/vant/pull/95)
|
||||
* Dialog: 支持通过组件的方式进行调用 [\#93](https://github.com/youzan/vant/pull/93)
|
||||
* Progress: 简化 DOM 结构 [\#90](https://github.com/youzan/vant/pull/90)
|
||||
* CellSwipe: 性能优化,补充单元测试 [\#91](https://github.com/youzan/vant/pull/91)
|
||||
* SwipeCell: 性能优化,补充单元测试 [\#91](https://github.com/youzan/vant/pull/91)
|
||||
|
||||
### [0.8.6](https://github.com/youzan/vant/tree/v0.8.6)
|
||||
|
||||
@ -1377,7 +1377,7 @@
|
||||
|
||||
* 支持 SSR [\#40](https://github.com/youzan/vant/pull/40)
|
||||
* 新增多个 Icon 类型 [\#40](https://github.com/youzan/vant/pull/40)
|
||||
* 新增 CellSwipe 组件 [\#39](https://github.com/youzan/vant/pull/39)
|
||||
* 新增 SwipeCell 组件 [\#39](https://github.com/youzan/vant/pull/39)
|
||||
* 新增 Search 组件微杂志样式 [\#38](https://github.com/youzan/vant/pull/38)
|
||||
|
||||
### [0.5.8](https://github.com/youzan/vant/tree/v0.5.8)
|
||||
|
@ -10,7 +10,6 @@ export default {
|
||||
'button': () => wrapper(import('../../packages/button/demo'), 'button'),
|
||||
'card': () => wrapper(import('../../packages/card/demo'), 'card'),
|
||||
'cell': () => wrapper(import('../../packages/cell/demo'), 'cell'),
|
||||
'cell-swipe': () => wrapper(import('../../packages/cell-swipe/demo'), 'cell-swipe'),
|
||||
'checkbox': () => wrapper(import('../../packages/checkbox/demo'), 'checkbox'),
|
||||
'circle': () => wrapper(import('../../packages/circle/demo'), 'circle'),
|
||||
'col': () => wrapper(import('../../packages/col/demo'), 'col'),
|
||||
@ -45,6 +44,7 @@ export default {
|
||||
'steps': () => wrapper(import('../../packages/steps/demo'), 'steps'),
|
||||
'submit-bar': () => wrapper(import('../../packages/submit-bar/demo'), 'submit-bar'),
|
||||
'swipe': () => wrapper(import('../../packages/swipe/demo'), 'swipe'),
|
||||
'swipe-cell': () => wrapper(import('../../packages/swipe-cell/demo'), 'swipe-cell'),
|
||||
'switch': () => wrapper(import('../../packages/switch/demo'), 'switch'),
|
||||
'switch-cell': () => wrapper(import('../../packages/switch-cell/demo'), 'switch-cell'),
|
||||
'tab': () => wrapper(import('../../packages/tab/demo'), 'tab'),
|
||||
|
@ -245,14 +245,14 @@ module.exports = {
|
||||
{
|
||||
groupName: '高阶组件',
|
||||
list: [
|
||||
{
|
||||
path: '/cell-swipe',
|
||||
title: 'CellSwipe 滑动单元格'
|
||||
},
|
||||
{
|
||||
path: '/image-preview',
|
||||
title: 'ImagePreview 图片预览'
|
||||
},
|
||||
{
|
||||
path: '/swipe-cell',
|
||||
title: 'SwipeCell 滑动单元格'
|
||||
},
|
||||
{
|
||||
path: '/switch-cell',
|
||||
title: 'SwitchCell 开关单元格'
|
||||
@ -542,8 +542,8 @@ module.exports = {
|
||||
groupName: 'Advanced Components',
|
||||
list: [
|
||||
{
|
||||
path: '/cell-swipe',
|
||||
title: 'CellSwipe'
|
||||
path: '/swipe-cell',
|
||||
title: 'SwipeCell'
|
||||
},
|
||||
{
|
||||
path: '/image-preview',
|
||||
|
@ -27,8 +27,6 @@ export default {
|
||||
'card.zh-CN': () => import('../../packages/card/zh-CN.md'),
|
||||
'cell.en-US': () => import('../../packages/cell/en-US.md'),
|
||||
'cell.zh-CN': () => import('../../packages/cell/zh-CN.md'),
|
||||
'cell-swipe.en-US': () => import('../../packages/cell-swipe/en-US.md'),
|
||||
'cell-swipe.zh-CN': () => import('../../packages/cell-swipe/zh-CN.md'),
|
||||
'checkbox.en-US': () => import('../../packages/checkbox/en-US.md'),
|
||||
'checkbox.zh-CN': () => import('../../packages/checkbox/zh-CN.md'),
|
||||
'circle.en-US': () => import('../../packages/circle/en-US.md'),
|
||||
@ -99,6 +97,8 @@ export default {
|
||||
'submit-bar.zh-CN': () => import('../../packages/submit-bar/zh-CN.md'),
|
||||
'swipe.en-US': () => import('../../packages/swipe/en-US.md'),
|
||||
'swipe.zh-CN': () => import('../../packages/swipe/zh-CN.md'),
|
||||
'swipe-cell.en-US': () => import('../../packages/swipe-cell/en-US.md'),
|
||||
'swipe-cell.zh-CN': () => import('../../packages/swipe-cell/zh-CN.md'),
|
||||
'switch.en-US': () => import('../../packages/switch/en-US.md'),
|
||||
'switch.zh-CN': () => import('../../packages/switch/zh-CN.md'),
|
||||
'switch-cell.en-US': () => import('../../packages/switch-cell/en-US.md'),
|
||||
|
@ -1,46 +0,0 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`drag and show left part 1`] = `
|
||||
<div class="van-cell-swipe">
|
||||
<div class="van-cell-swipe__wrapper">
|
||||
<div class="van-cell-swipe__left"></div>
|
||||
<div class="van-cell-swipe__right"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`drag and show left part 2`] = `
|
||||
<div class="van-cell-swipe">
|
||||
<div class="van-cell-swipe__wrapper">
|
||||
<div class="van-cell-swipe__left"></div>
|
||||
<div class="van-cell-swipe__right"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`drag and show left part 3`] = `
|
||||
<div class="van-cell-swipe">
|
||||
<div class="van-cell-swipe__wrapper">
|
||||
<div class="van-cell-swipe__left"></div>
|
||||
<div class="van-cell-swipe__right"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`drag and show left part 4`] = `
|
||||
<div class="van-cell-swipe">
|
||||
<div class="van-cell-swipe__wrapper">
|
||||
<div class="van-cell-swipe__left"></div>
|
||||
<div class="van-cell-swipe__right"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`drag and show left part 5`] = `
|
||||
<div class="van-cell-swipe">
|
||||
<div class="van-cell-swipe__wrapper">
|
||||
<div class="van-cell-swipe__left"></div>
|
||||
<div class="van-cell-swipe__right"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
@ -9,7 +9,6 @@ import Button from './button';
|
||||
import Card from './card';
|
||||
import Cell from './cell';
|
||||
import CellGroup from './cell-group';
|
||||
import CellSwipe from './cell-swipe';
|
||||
import Checkbox from './checkbox';
|
||||
import CheckboxGroup from './checkbox-group';
|
||||
import Circle from './circle';
|
||||
@ -55,6 +54,7 @@ import Stepper from './stepper';
|
||||
import Steps from './steps';
|
||||
import SubmitBar from './submit-bar';
|
||||
import Swipe from './swipe';
|
||||
import SwipeCell from './swipe-cell';
|
||||
import SwipeItem from './swipe-item';
|
||||
import Switch from './switch';
|
||||
import SwitchCell from './switch-cell';
|
||||
@ -80,7 +80,6 @@ const components = [
|
||||
Card,
|
||||
Cell,
|
||||
CellGroup,
|
||||
CellSwipe,
|
||||
Checkbox,
|
||||
CheckboxGroup,
|
||||
Circle,
|
||||
@ -125,6 +124,7 @@ const components = [
|
||||
Steps,
|
||||
SubmitBar,
|
||||
Swipe,
|
||||
SwipeCell,
|
||||
SwipeItem,
|
||||
Switch,
|
||||
SwitchCell,
|
||||
@ -162,7 +162,6 @@ export {
|
||||
Card,
|
||||
Cell,
|
||||
CellGroup,
|
||||
CellSwipe,
|
||||
Checkbox,
|
||||
CheckboxGroup,
|
||||
Circle,
|
||||
@ -208,6 +207,7 @@ export {
|
||||
Steps,
|
||||
SubmitBar,
|
||||
Swipe,
|
||||
SwipeCell,
|
||||
SwipeItem,
|
||||
Switch,
|
||||
SwitchCell,
|
||||
|
@ -3,23 +3,23 @@
|
||||
<demo-section>
|
||||
<van-notice-bar>{{ $t('tips') }}</van-notice-bar>
|
||||
<demo-block :title="$t('basicUsage')">
|
||||
<van-cell-swipe :right-width="65" :left-width="65">
|
||||
<van-swipe-cell :right-width="65" :left-width="65">
|
||||
<span slot="left">{{ $t('button1') }}</span>
|
||||
<van-cell-group>
|
||||
<van-cell :title="$t('title')" :value="$t('content')" />
|
||||
</van-cell-group>
|
||||
<span slot="right">{{ $t('button2') }}</span>
|
||||
</van-cell-swipe>
|
||||
</van-swipe-cell>
|
||||
</demo-block>
|
||||
|
||||
<demo-block :title="$t('title2')">
|
||||
<van-cell-swipe :right-width="65" :left-width="65" :on-close="onClose">
|
||||
<van-swipe-cell :right-width="65" :left-width="65" :on-close="onClose">
|
||||
<span slot="left">{{ $t('button1') }}</span>
|
||||
<van-cell-group>
|
||||
<van-cell :title="$t('title')" :value="$t('content')" />
|
||||
</van-cell-group>
|
||||
<span slot="right">{{ $t('button2') }}</span>
|
||||
</van-cell-swipe>
|
||||
</van-swipe-cell>
|
||||
</demo-block>
|
||||
</demo-section>
|
||||
</div>
|
||||
@ -68,10 +68,10 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="postcss">
|
||||
.demo-cell-swipe {
|
||||
.demo-swipe-cell {
|
||||
user-select: none;
|
||||
|
||||
.van-cell-swipe {
|
||||
.van-swipe-cell {
|
||||
&__left,
|
||||
&__right {
|
||||
color: #FFFFFF;
|
@ -1,10 +1,10 @@
|
||||
## CellSwipe
|
||||
## SwipeCell
|
||||
|
||||
### Install
|
||||
``` javascript
|
||||
import { CellSwipe } from 'vant';
|
||||
import { SwipeCell } from 'vant';
|
||||
|
||||
Vue.use(CellSwipe);
|
||||
Vue.use(SwipeCell);
|
||||
```
|
||||
|
||||
### Usage
|
||||
@ -12,25 +12,25 @@ Vue.use(CellSwipe);
|
||||
#### Basic Usage
|
||||
|
||||
```html
|
||||
<van-cell-swipe :right-width="65" :left-width="65">
|
||||
<van-swipe-cell :right-width="65" :left-width="65">
|
||||
<span slot="left">Select</span>
|
||||
<van-cell-group>
|
||||
<van-cell title="Cell" value="Cell Content" />
|
||||
</van-cell-group>
|
||||
<span slot="right">Delete</span>
|
||||
</van-cell-swipe>
|
||||
</van-swipe-cell>
|
||||
```
|
||||
|
||||
#### Async close
|
||||
|
||||
```html
|
||||
<van-cell-swipe :right-width="65" :left-width="65" :on-close="onClose">
|
||||
<van-swipe-cell :right-width="65" :left-width="65" :on-close="onClose">
|
||||
<span slot="left">Select</span>
|
||||
<van-cell-group>
|
||||
<van-cell title="Cell" value="Cell Content" />
|
||||
</van-cell-group>
|
||||
<span slot="right">Delete</span>
|
||||
</van-cell-swipe>
|
||||
</van-swipe-cell>
|
||||
```
|
||||
|
||||
```js
|
||||
@ -77,13 +77,13 @@ export default {
|
||||
| Argument | Type | Description |
|
||||
|-----------|-----------|-----------|
|
||||
| clickPosition | `String` | Click positon (`left` `right` `cell` `outside`) |
|
||||
| instance | `Object` | CellSwipe instance |
|
||||
| instance | `Object` | SwipeCell instance |
|
||||
|
||||
### Methods
|
||||
|
||||
Use ref to get CellSwipe instance and call instance methods
|
||||
Use ref to get SwipeCell instance and call instance methods
|
||||
|
||||
| Name | Attribute | Return value | Description |
|
||||
|-----------|-----------|-----------|-------------|
|
||||
| open | position: 'left' \| 'right' | - | open CellSwipe |
|
||||
| close | - | - | close CellSwipe |
|
||||
| open | position: 'left' \| 'right' | - | open SwipeCell |
|
||||
| close | - | - | close SwipeCell |
|
@ -32,7 +32,7 @@ import Touch from '../mixins/touch';
|
||||
const THRESHOLD = 0.15;
|
||||
|
||||
export default create({
|
||||
name: 'cell-swipe',
|
||||
name: 'swipe-cell',
|
||||
|
||||
mixins: [Touch],
|
||||
|
@ -11,9 +11,9 @@ exports[`renders demo correctly 1`] = `
|
||||
<!---->
|
||||
</div>
|
||||
<div>
|
||||
<div class="van-cell-swipe">
|
||||
<div class="van-cell-swipe__wrapper" style="transform:translate3d(0px, 0, 0);transition:.6s cubic-bezier(0.18, 0.89, 0.32, 1);">
|
||||
<div class="van-cell-swipe__left"><span>选择</span></div>
|
||||
<div class="van-swipe-cell">
|
||||
<div class="van-swipe-cell__wrapper" style="transform:translate3d(0px, 0, 0);transition:.6s cubic-bezier(0.18, 0.89, 0.32, 1);">
|
||||
<div class="van-swipe-cell__left"><span>选择</span></div>
|
||||
<div class="van-cell-group van-hairline--top-bottom">
|
||||
<div class="van-cell van-hairline">
|
||||
<!---->
|
||||
@ -24,14 +24,14 @@ exports[`renders demo correctly 1`] = `
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
<div class="van-cell-swipe__right"><span>删除</span></div>
|
||||
<div class="van-swipe-cell__right"><span>删除</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="van-cell-swipe">
|
||||
<div class="van-cell-swipe__wrapper" style="transform:translate3d(0px, 0, 0);transition:.6s cubic-bezier(0.18, 0.89, 0.32, 1);">
|
||||
<div class="van-cell-swipe__left"><span>选择</span></div>
|
||||
<div class="van-swipe-cell">
|
||||
<div class="van-swipe-cell__wrapper" style="transform:translate3d(0px, 0, 0);transition:.6s cubic-bezier(0.18, 0.89, 0.32, 1);">
|
||||
<div class="van-swipe-cell__left"><span>选择</span></div>
|
||||
<div class="van-cell-group van-hairline--top-bottom">
|
||||
<div class="van-cell van-hairline">
|
||||
<!---->
|
||||
@ -42,7 +42,7 @@ exports[`renders demo correctly 1`] = `
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
<div class="van-cell-swipe__right"><span>删除</span></div>
|
||||
<div class="van-swipe-cell__right"><span>删除</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
46
packages/swipe-cell/test/__snapshots__/index.spec.js.snap
Normal file
46
packages/swipe-cell/test/__snapshots__/index.spec.js.snap
Normal file
@ -0,0 +1,46 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`drag and show left part 1`] = `
|
||||
<div class="van-swipe-cell">
|
||||
<div class="van-swipe-cell__wrapper">
|
||||
<div class="van-swipe-cell__left"></div>
|
||||
<div class="van-swipe-cell__right"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`drag and show left part 2`] = `
|
||||
<div class="van-swipe-cell">
|
||||
<div class="van-swipe-cell__wrapper">
|
||||
<div class="van-swipe-cell__left"></div>
|
||||
<div class="van-swipe-cell__right"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`drag and show left part 3`] = `
|
||||
<div class="van-swipe-cell">
|
||||
<div class="van-swipe-cell__wrapper">
|
||||
<div class="van-swipe-cell__left"></div>
|
||||
<div class="van-swipe-cell__right"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`drag and show left part 4`] = `
|
||||
<div class="van-swipe-cell">
|
||||
<div class="van-swipe-cell__wrapper">
|
||||
<div class="van-swipe-cell__left"></div>
|
||||
<div class="van-swipe-cell__right"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`drag and show left part 5`] = `
|
||||
<div class="van-swipe-cell">
|
||||
<div class="van-swipe-cell__wrapper">
|
||||
<div class="van-swipe-cell__left"></div>
|
||||
<div class="van-swipe-cell__right"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
@ -1,4 +1,4 @@
|
||||
import CellSwipe from '..';
|
||||
import SwipeCell from '..';
|
||||
import { mount, triggerDrag } from '../../../test/utils';
|
||||
|
||||
const defaultProps = {
|
||||
@ -9,7 +9,7 @@ const defaultProps = {
|
||||
};
|
||||
|
||||
it('drag and show left part', () => {
|
||||
const wrapper = mount(CellSwipe, defaultProps);
|
||||
const wrapper = mount(SwipeCell, defaultProps);
|
||||
|
||||
triggerDrag(wrapper, 10, 0);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
@ -25,7 +25,7 @@ it('drag and show left part', () => {
|
||||
});
|
||||
|
||||
it('drag and show left part', () => {
|
||||
const wrapper = mount(CellSwipe, defaultProps);
|
||||
const wrapper = mount(SwipeCell, defaultProps);
|
||||
|
||||
triggerDrag(wrapper, -50, 0);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
@ -35,7 +35,7 @@ test('on close prop', () => {
|
||||
let position;
|
||||
let instance;
|
||||
|
||||
const wrapper = mount(CellSwipe, {
|
||||
const wrapper = mount(SwipeCell, {
|
||||
propsData: {
|
||||
...defaultProps.propsData,
|
||||
onClose(pos, ins) {
|
||||
@ -51,10 +51,10 @@ test('on close prop', () => {
|
||||
wrapper.trigger('click');
|
||||
expect(position).toEqual('cell');
|
||||
|
||||
wrapper.find('.van-cell-swipe__left').trigger('click');
|
||||
wrapper.find('.van-swipe-cell__left').trigger('click');
|
||||
expect(position).toEqual('left');
|
||||
|
||||
wrapper.find('.van-cell-swipe__right').trigger('click');
|
||||
wrapper.find('.van-swipe-cell__right').trigger('click');
|
||||
expect(position).toEqual('right');
|
||||
|
||||
instance.close();
|
@ -1,10 +1,10 @@
|
||||
## CellSwipe 滑动单元格
|
||||
## SwipeCell 滑动单元格
|
||||
|
||||
### 使用指南
|
||||
``` javascript
|
||||
import { CellSwipe } from 'vant';
|
||||
import { SwipeCell } from 'vant';
|
||||
|
||||
Vue.use(CellSwipe);
|
||||
Vue.use(SwipeCell);
|
||||
```
|
||||
|
||||
### 代码演示
|
||||
@ -12,25 +12,25 @@ Vue.use(CellSwipe);
|
||||
#### 基础用法
|
||||
|
||||
```html
|
||||
<van-cell-swipe :right-width="65" :left-width="65">
|
||||
<van-swipe-cell :right-width="65" :left-width="65">
|
||||
<span slot="left">选择</span>
|
||||
<van-cell-group>
|
||||
<van-cell title="单元格" value="内容" />
|
||||
</van-cell-group>
|
||||
<span slot="right">删除</span>
|
||||
</van-cell-swipe>
|
||||
</van-swipe-cell>
|
||||
```
|
||||
|
||||
#### 异步关闭
|
||||
|
||||
```html
|
||||
<van-cell-swipe :right-width="65" :left-width="65" :on-close="onClose">
|
||||
<van-swipe-cell :right-width="65" :left-width="65" :on-close="onClose">
|
||||
<span slot="left">选择</span>
|
||||
<van-cell-group>
|
||||
<van-cell title="单元格" value="内容" />
|
||||
</van-cell-group>
|
||||
<span slot="right">删除</span>
|
||||
</van-cell-swipe>
|
||||
</van-swipe-cell>
|
||||
```
|
||||
|
||||
```js
|
||||
@ -77,11 +77,11 @@ export default {
|
||||
| 参数 | 类型 | 说明 |
|
||||
|-----------|-----------|-----------|
|
||||
| clickPosition | `String` | 关闭时的点击位置 (`left` `right` `cell` `outside`) |
|
||||
| instance | `Object` | CellSwipe 实例 |
|
||||
| instance | `Object` | SwipeCell 实例 |
|
||||
|
||||
### 方法
|
||||
|
||||
通过 ref 可以获取到 CellSwipe 实例并调用实例方法
|
||||
通过 ref 可以获取到 SwipeCell 实例并调用实例方法
|
||||
|
||||
| 方法名 | 参数 | 返回值 | 介绍 |
|
||||
|-----------|-----------|-----------|-------------|
|
@ -46,7 +46,7 @@
|
||||
@import './toast.css';
|
||||
|
||||
/* high order components */
|
||||
@import './cell-swipe.css';
|
||||
@import './swipe-cell.css';
|
||||
@import './switch-cell.css';
|
||||
@import './tree-select.css';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
@import './common/var.css';
|
||||
|
||||
.van-cell-swipe {
|
||||
.van-swipe-cell {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
2
types/index.d.ts
vendored
2
types/index.d.ts
vendored
@ -19,7 +19,7 @@ export class Button extends VanComponent {}
|
||||
export class Card extends VanComponent {}
|
||||
export class Cell extends VanComponent {}
|
||||
export class CellGroup extends VanComponent {}
|
||||
export class CellSwipe extends VanComponent {}
|
||||
export class SwipeCell extends VanComponent {}
|
||||
export class Checkbox extends VanComponent {}
|
||||
export class CheckboxGroup extends VanComponent {}
|
||||
export class Circle extends VanComponent {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user