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