element 周选择器 type=“week“时 使用value-format 保错怎么解决

1.使用周选择器

      <el-date-picker
      id='getweekDate'
      v-model="weekDate"
      type="week"
      format="yyyy 第 WW 周"
      placeholder="选择周">

2.创建字段

data(){
return {
weekData: null,
weekDataNow: null
}
}

3.使用watch监听

watch: {
weekData() {
if( this.weekData !== null) {
this.$nextTick(()=>{
this.weekDataNow = document.querySelector('#getweekData').value
})
}
}
}

完成

4.调用weekDataNow即可

猜你喜欢

转载自blog.csdn.net/weixin_60196946/article/details/130521902