提交 b7416f78 编写于 作者: A AmyFoxFN

<update>(slide): batch add props watch

上级 24fcae75
......@@ -64,29 +64,19 @@
currentPageIndex: this.initialIndex || 0
}
},
created() {
const needRefreshProps = ['data', 'loop', 'autoPlay', 'threshold', 'speed', 'allowVertical']
needRefreshProps.forEach((key) => {
this.$watch(key, () => {
this.refresh()
})
})
},
watch: {
data() {
this.refresh()
},
initialIndex(newIndex) {
if (newIndex !== this.currentPageIndex) {
this.slide && this.slide.goToPage(newIndex)
}
},
loop() {
this.refresh()
},
autoPlay() {
this.refresh()
},
threshold() {
this.refresh()
},
speed() {
this.refresh()
},
allowVertical() {
this.refresh()
}
},
methods: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册