mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[improvement] optimize watch options (#4075)
This commit is contained in:
parent
854a91c384
commit
19cd2ed38e
@ -51,9 +51,7 @@ export default createComponent({
|
||||
|
||||
areaList: {
|
||||
deep: true,
|
||||
handler() {
|
||||
this.setValues();
|
||||
}
|
||||
handler: 'setValues'
|
||||
},
|
||||
|
||||
columnsNum() {
|
||||
|
@ -35,7 +35,7 @@
|
||||
<van-count-down
|
||||
ref="countDown"
|
||||
millisecond
|
||||
:time="manualTime"
|
||||
:time="3000"
|
||||
:auto-start="false"
|
||||
format="ss:SSS"
|
||||
@finish="$toast($t('finished'))"
|
||||
@ -73,7 +73,6 @@ export default {
|
||||
customFormat: '自定义格式',
|
||||
manualControl: '手动控制',
|
||||
formatWithDay: 'DD 天 HH 时 mm 分 ss 秒',
|
||||
add: '延长',
|
||||
reset: '重置',
|
||||
pause: '暂停',
|
||||
start: '开始',
|
||||
@ -85,7 +84,6 @@ export default {
|
||||
customFormat: 'Custom Format',
|
||||
manualControl: 'Manual Control',
|
||||
formatWithDay: 'DD Day, HH:mm:ss',
|
||||
add: 'Add',
|
||||
reset: 'Reset',
|
||||
pause: 'Pause',
|
||||
start: 'Start',
|
||||
@ -95,8 +93,7 @@ export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
time: 30 * 60 * 60 * 1000,
|
||||
manualTime: 3000
|
||||
time: 30 * 60 * 60 * 1000
|
||||
};
|
||||
},
|
||||
|
||||
@ -111,10 +108,6 @@ export default {
|
||||
|
||||
reset() {
|
||||
this.$refs.countDown.reset();
|
||||
},
|
||||
|
||||
add() {
|
||||
this.manualTime += 3000;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -40,9 +40,7 @@ export default createComponent({
|
||||
watch: {
|
||||
time: {
|
||||
immediate: true,
|
||||
handler() {
|
||||
this.reset();
|
||||
}
|
||||
handler: 'reset'
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -94,9 +94,7 @@ export default createComponent({
|
||||
this.$emit('input', code);
|
||||
},
|
||||
|
||||
displayedCouponIndex(val) {
|
||||
this.scrollToShowCoupon(val);
|
||||
}
|
||||
displayedCouponIndex: 'scrollToShowCoupon'
|
||||
},
|
||||
|
||||
mounted() {
|
||||
|
@ -62,9 +62,7 @@ export const PopupMixin = {
|
||||
this.$emit(type);
|
||||
},
|
||||
|
||||
overlay() {
|
||||
this.renderOverlay();
|
||||
}
|
||||
overlay: 'renderOverlay'
|
||||
},
|
||||
|
||||
mounted() {
|
||||
|
@ -20,9 +20,7 @@ export function PortalMixin({ afterPortal }: PortalMixinOptions) {
|
||||
},
|
||||
|
||||
watch: {
|
||||
getContainer() {
|
||||
this.portal();
|
||||
}
|
||||
getContainer: 'portal'
|
||||
},
|
||||
|
||||
mounted() {
|
||||
|
@ -42,9 +42,7 @@ export default createComponent({
|
||||
},
|
||||
|
||||
watch: {
|
||||
columns() {
|
||||
this.setColumns();
|
||||
}
|
||||
columns: 'setColumns'
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
@ -35,21 +35,16 @@ export default createComponent({
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getWidth();
|
||||
this.setWidth();
|
||||
},
|
||||
|
||||
watch: {
|
||||
showPivot() {
|
||||
this.getWidth();
|
||||
},
|
||||
|
||||
pivotText() {
|
||||
this.getWidth();
|
||||
}
|
||||
showPivot: 'setWidth',
|
||||
pivotText: 'setWidth'
|
||||
},
|
||||
|
||||
methods: {
|
||||
getWidth() {
|
||||
setWidth() {
|
||||
this.$nextTick(() => {
|
||||
this.progressWidth = this.$el.offsetWidth;
|
||||
this.pivotWidth = this.$refs.pivot ? this.$refs.pivot.offsetWidth : 0;
|
||||
|
@ -105,9 +105,7 @@ export default createComponent({
|
||||
this.show = val;
|
||||
},
|
||||
|
||||
skuTree(val) {
|
||||
this.resetSelectedSku(val);
|
||||
}
|
||||
skuTree: 'resetSelectedSku'
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
@ -30,13 +30,8 @@ export default createComponent({
|
||||
},
|
||||
|
||||
watch: {
|
||||
children() {
|
||||
this.setActiveItem();
|
||||
},
|
||||
|
||||
value() {
|
||||
this.setActiveItem();
|
||||
}
|
||||
value: 'setActiveItem',
|
||||
children: 'setActiveItem'
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
@ -99,16 +99,14 @@ export default createComponent({
|
||||
},
|
||||
|
||||
watch: {
|
||||
color: 'setLine',
|
||||
|
||||
active(name) {
|
||||
if (name !== this.currentName) {
|
||||
this.setCurrentIndexByName(name);
|
||||
}
|
||||
},
|
||||
|
||||
color() {
|
||||
this.setLine();
|
||||
},
|
||||
|
||||
children() {
|
||||
this.setCurrentIndexByName(this.currentName || this.active);
|
||||
this.scrollIntoView();
|
||||
|
@ -44,13 +44,8 @@ export default createComponent({
|
||||
},
|
||||
|
||||
watch: {
|
||||
value() {
|
||||
this.toggleClickable();
|
||||
},
|
||||
|
||||
forbidClick() {
|
||||
this.toggleClickable();
|
||||
}
|
||||
value: 'toggleClickable',
|
||||
forbidClick: 'toggleClickable'
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user