Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue 问题修改:#1708、#1731 #1745

Merged
merged 9 commits into from
Oct 18, 2022
2 changes: 1 addition & 1 deletion src/packages/__VUE/address/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### 介绍

按需加载请加载对应依赖组件 Icon Popup Elevator
请加载对应依赖组件 Icon Popup Elevator

### 安装

Expand Down
4 changes: 3 additions & 1 deletion src/packages/__VUE/address/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ export default create({

// 关闭
const close = () => {
console.log('关闭', closeWay.value, showPopup.value);
const resCopy = Object.assign(
{
addressIdStr: '',
Expand Down Expand Up @@ -530,8 +531,9 @@ export default create({
watch(
() => showPopup.value,
(value) => {
console.log('监听 showpopup', showPopup.value);
if (value == false) {
close();
// close();
} else {
initCustomSelected();
}
Expand Down
1 change: 1 addition & 0 deletions src/packages/__VUE/datepicker/demo.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div class="demo">
<nut-cell-group :title="translate('basic')">
{{ currentDate }}
<nut-cell :title="translate('showChinese')" :desc="desc1" @click="show = true"></nut-cell>
</nut-cell-group>

Expand Down
22 changes: 18 additions & 4 deletions src/packages/__VUE/datepicker/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default create({
},
filter: Function as PropType<import('./type').Filter>
},
emits: ['click', 'update:visible', 'change', 'confirm', 'update:moduleValue'],
emits: ['click', 'update:visible', 'change', 'confirm', 'update:modelValue'],

setup(props, { emit }) {
const state = reactive({
Expand Down Expand Up @@ -249,11 +249,11 @@ export default create({
formatDate.push(item);
});
if (props.type == 'month-day' && formatDate.length < 3) {
formatDate.unshift(new Date(props.modelValue || props.minDate || props.maxDate).getFullYear());
formatDate.unshift(new Date(state.currentDate || props.minDate || props.maxDate).getFullYear());
}

if (props.type == 'year-month' && formatDate.length < 3) {
formatDate.push(new Date(props.modelValue || props.minDate || props.maxDate).getDate());
formatDate.push(new Date(state.currentDate || props.minDate || props.maxDate).getDate());
}

const year = Number(formatDate[0]);
Expand Down Expand Up @@ -340,7 +340,21 @@ export default create({
watch(
() => props.modelValue,
(value) => {
state.currentDate = formatValue(value);
const newValues = formatValue(value);
const isSameValue = JSON.stringify(newValues) === JSON.stringify(state.currentDate);
if (!isSameValue) {
state.currentDate = newValues;
}
}
);

watch(
() => state.currentDate,
(newValues) => {
const isSameValue = JSON.stringify(newValues) === JSON.stringify(props.modelValue);
if (!isSameValue) {
emit('update:modelValue', newValues);
}
}
);

Expand Down