diff --git a/docs/demos/views/swipe.vue b/docs/demos/views/swipe.vue index ca66d62d9..9b5e43ea8 100644 --- a/docs/demos/views/swipe.vue +++ b/docs/demos/views/swipe.vue @@ -16,6 +16,15 @@ + + + + 1 + 2 + 3 + 4 + + @@ -23,10 +32,14 @@ export default { i18n: { 'zh-CN': { - title2: '图片懒加载' + title2: '图片懒加载', + title3: '监听 change 事件', + message: '当前 Swipe 索引:' }, 'en-US': { - title2: 'Image Lazyload' + title2: 'Image Lazyload', + title3: 'Change Event', + message: 'Current Swipe index:' } }, @@ -39,6 +52,12 @@ export default { 'https://img.yzcdn.cn/public_files/2017/09/05/fd08f07665ed67d50e11b32a21ce0682.jpg' ] }; + }, + + methods: { + onChange(index) { + this.$toast(this.$t('message') + index); + } } }; diff --git a/docs/markdown/en-US/swipe.md b/docs/markdown/en-US/swipe.md index 08aa3d835..a4444023f 100644 --- a/docs/markdown/en-US/swipe.md +++ b/docs/markdown/en-US/swipe.md @@ -45,6 +45,27 @@ export default { } ``` +#### change event + +```html + + 1 + 2 + 3 + 4 + +``` + +```js +export default { + methods: { + onChange(index) { + Toast('Current Swipe index:' + index); + } + } +} +``` + ### API | Attribute | Description | Type | Default | Accepted Values | diff --git a/docs/markdown/zh-CN/swipe.md b/docs/markdown/zh-CN/swipe.md index 4fa730cd7..1e8c331f8 100644 --- a/docs/markdown/zh-CN/swipe.md +++ b/docs/markdown/zh-CN/swipe.md @@ -45,6 +45,27 @@ export default { } ``` +#### 监听 change 事件 + +```html + + 1 + 2 + 3 + 4 + +``` + +```js +export default { + methods: { + onChange(index) { + Toast('当前 Swipe 索引:' + index); + } + } +} +``` + ### API | 参数 | 说明 | 类型 | 默认值 | 可选值 |