vux [Bug Report] datatime不能在mounted下初始化值

elcex8rz  于 2023-03-19  发布在  其他
关注(0)|答案(1)|浏览(239)

VUX version

2.9.2

OS/Browsers version

mui8/vue的app

Vue version

2.5.17-beta.0

Code

<template>
 <datetime v-model="time" :placeholder="'选择'"  format="YYYY-MM-DD"></datetime>
<span @click="fn"></span>
</template>
<script>
export default {
  name: 'school',
  data () {
    return {
      time :''
    }
  },
methods:{
   fn(){
   this.time = '2017-10-10'
 }
},
mounted(){
  this.time = '2017-10-10'
}
}

</script>

Steps to reproduce

在mounted里面初始化time的值datetime的文本框值没变化,但是点击事件fn却能够改变datetime的文本框值,mounted不可以?这是怎么回事?

What is Expected?

解决mounted初始化值的问题

What is actually happening?

lc8prwob

lc8prwob1#

mounted() {
this.$nextTick(()=>{
this.time= '2017-10-10'
})
}
nextTick加上就可以了 应该是要等dom渲染完

相关问题