|
@@ -51,9 +51,7 @@
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';
|
|
import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';
|
|
-import moment from 'moment'
|
|
|
|
-import 'moment/locale/zh-cn';
|
|
|
|
-moment.locale('zh-cn');//配置moment中文环境
|
|
|
|
|
|
+import moment from 'moment';//引入moment
|
|
export default {
|
|
export default {
|
|
props: {
|
|
props: {
|
|
value: {
|
|
value: {
|
|
@@ -78,8 +76,8 @@ export default {
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
locale,
|
|
locale,
|
|
- startValue: this.value[0]||undefined,
|
|
|
|
- endValue: this.value[1]||undefined,
|
|
|
|
|
|
+ startValue: null,
|
|
|
|
+ endValue: null,
|
|
endOpen: false,
|
|
endOpen: false,
|
|
startOpen: false,
|
|
startOpen: false,
|
|
ranges: {
|
|
ranges: {
|
|
@@ -96,19 +94,19 @@ export default {
|
|
watch: {
|
|
watch: {
|
|
startValue (val,old) {
|
|
startValue (val,old) {
|
|
if(old&&!val){
|
|
if(old&&!val){
|
|
- this.endValue = undefined
|
|
|
|
|
|
+ this.endValue = null
|
|
}
|
|
}
|
|
if(val && !this.endValue){
|
|
if(val && !this.endValue){
|
|
this.endOpen = true
|
|
this.endOpen = true
|
|
}
|
|
}
|
|
- this.startValue = val
|
|
|
|
|
|
+ this.startValue = val || null
|
|
this.changeInput()
|
|
this.changeInput()
|
|
},
|
|
},
|
|
endValue (val,old) {
|
|
endValue (val,old) {
|
|
if(old&&!val){
|
|
if(old&&!val){
|
|
- this.startValue = undefined
|
|
|
|
|
|
+ this.startValue = null
|
|
}
|
|
}
|
|
- this.endValue = val
|
|
|
|
|
|
+ this.endValue = val || null
|
|
this.changeInput()
|
|
this.changeInput()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -194,8 +192,8 @@ export default {
|
|
this.$emit('change', dateStrings)
|
|
this.$emit('change', dateStrings)
|
|
},
|
|
},
|
|
resetDate (val) {
|
|
resetDate (val) {
|
|
- this.startValue = val && val[0] || undefined
|
|
|
|
- this.endValue = val && val[1] || undefined
|
|
|
|
|
|
+ this.startValue = val && val[0] ? val[0] : null
|
|
|
|
+ this.endValue = val && val[1] ? val[1] : null
|
|
this.$emit('change', [])
|
|
this.$emit('change', [])
|
|
}
|
|
}
|
|
}
|
|
}
|