|
@@ -37,37 +37,42 @@ export default {
|
|
|
selectTime: {
|
|
|
start: 0,
|
|
|
end: 0,
|
|
|
- exact: 'all'
|
|
|
+ exact: ''
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
value: {
|
|
|
handler(val) {
|
|
|
- const time = this.transformTimeBefore(val)
|
|
|
- if (time.indexOf('_') === -1) {
|
|
|
- this.selectTime = {
|
|
|
- start: 0,
|
|
|
- end: 0,
|
|
|
- exact: time
|
|
|
- }
|
|
|
- } else {
|
|
|
- const times = time.split('_')
|
|
|
- this.selectTime = {
|
|
|
- start: times[0] * 1000,
|
|
|
- end: times[1] * 1000,
|
|
|
- exact: 'exact'
|
|
|
- }
|
|
|
- }
|
|
|
- if (this.$refs.content) {
|
|
|
- this.$refs.content.setState(this.selectTime)
|
|
|
- }
|
|
|
+ this.syncState(val)
|
|
|
},
|
|
|
deep: true
|
|
|
}
|
|
|
},
|
|
|
- created() {},
|
|
|
+ mounted() {
|
|
|
+ this.syncState(this.value)
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ syncState(val) {
|
|
|
+ const time = this.transformTimeBefore(val)
|
|
|
+ if (time.indexOf('_') === -1) {
|
|
|
+ this.selectTime = {
|
|
|
+ start: 0,
|
|
|
+ end: 0,
|
|
|
+ exact: time
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const times = time.split('_')
|
|
|
+ this.selectTime = {
|
|
|
+ start: times[0] * 1000,
|
|
|
+ end: times[1] * 1000,
|
|
|
+ exact: 'exact'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.$refs.content) {
|
|
|
+ this.$refs.content.setState(this.selectTime)
|
|
|
+ }
|
|
|
+ },
|
|
|
setState(data) {
|
|
|
return this.$refs.content.setState(data)
|
|
|
},
|