fix infinite-looping issue

This commit is contained in:
Mohit Panjwani
2020-12-22 17:48:21 +05:30
parent d1e70c8989
commit fae3af2592
4 changed files with 18 additions and 13 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1,4 +1,4 @@
{ {
"/assets/js/app.js": "/assets/js/app.js?id=098536c1ae80d55319ef", "/assets/js/app.js": "/assets/js/app.js?id=a29cebdf01e89dfe271d",
"/assets/css/crater.css": "/assets/css/crater.css?id=180193a313e33aed1712" "/assets/css/crater.css": "/assets/css/crater.css?id=ab11b7a088da61b14bb8"
} }
@@ -74,15 +74,17 @@ export default {
}), }),
}, },
watch: { watch: {
value(val) { // value(val) {
if (val && !this.enableTime) { // console.log(val)
this.date = moment(new Date(val), 'YYYY-MM-DD').format('YYYY-MM-DD')
} else { // if (val && !this.enableTime) {
this.date = moment(new Date(val), 'YYYY-MM-DD').format( // this.date = moment(new Date(val), 'YYYY-MM-DD').format('YYYY-MM-DD')
'YYYY-MM-DD H:m:s' // } else {
) // this.date = moment(new Date(val), 'YYYY-MM-DD').format(
} // 'YYYY-MM-DD H:m:s'
}, // )
// }
// },
enableTime(val) { enableTime(val) {
this.$set(this.config, 'enableTime', this.enableTime) this.$set(this.config, 'enableTime', this.enableTime)
}, },
@@ -104,6 +106,7 @@ export default {
}, },
mounted() { mounted() {
this.$set(this.config, 'enableTime', this.enableTime) this.$set(this.config, 'enableTime', this.enableTime)
if (!this.enableTime) { if (!this.enableTime) {
this.$set( this.$set(
this.config, this.config,
@@ -117,12 +120,14 @@ export default {
this.carbonFormat ? `${this.carbonFormat} H:i ` : 'd M Y H:i' this.carbonFormat ? `${this.carbonFormat} H:i ` : 'd M Y H:i'
) )
} }
if (this.value && !this.enableTime) { if (this.value && !this.enableTime) {
this.date = moment(new Date(this.value), 'YYYY-MM-DD').format( this.date = moment(new Date(this.value), 'YYYY-MM-DD').format(
'YYYY-MM-DD' 'YYYY-MM-DD'
) )
return true return true
} }
if (this.value) { if (this.value) {
this.date = moment(new Date(this.value), 'YYYY-MM-DD').format( this.date = moment(new Date(this.value), 'YYYY-MM-DD').format(
'YYYY-MM-DD HH:mm:SS' 'YYYY-MM-DD HH:mm:SS'