vue el-date-picker 日期选择 回显后成功后无法改变的解决办法(亲测可用)
点击修改按钮赋值的时候用这种方法就可以了,具体原理我也没清楚,但是确实可以this.set(this.form,"alldate",[this.form.startdate,this.form.endate])this.set(this.form,"alldate",[this.form.startdate,this.form.endate])this.set(this.form,"alldate
点击修改按钮赋值的时候用这种方法就可以了,具体原理我也没清楚,但是确实可以
this.
s
e
t
(
t
h
i
s
.
f
o
r
m
,
"
a
l
l
d
a
t
e
"
,
[
t
h
i
s
.
f
o
r
m
.
s
t
a
r
t
d
a
t
e
,
t
h
i
s
.
f
o
r
m
.
e
n
d
a
t
e
]
)
t
h
i
s
.
set(this.form,"alldate",[this.form.startdate,this.form.endate]) this.
set(this.form,"alldate",[this.form.startdate,this.form.endate])this.set(原数组, 索引值, 需要赋的值)
代码:
/** 修改按钮操作 */
handleUpdate(row) {
getAdShops(id).then(response => {
if(response.data.adTimeStart!=null && response.data.adTimeEnd!=null){
//用这个方法赋值
this.$set(this.form,"adTime",[ response.data.adTimeStart,response.data.adTimeEnd])
}
});
},
<el-col :span="12">
<el-form-item label="广告投放时间" prop="adTime">
<el-date-picker
v-model="form.adTime"
type="daterange"
range-separator="至"
style="width: 60%"
start-placeholder="开始日期"
end-placeholder="结束日期"
clearable
value-format="yyyy-MM-dd"
@blur="changePackageTime"
>
</el-date-picker>
</el-form-item>
</el-col>
changePackageTime() {
this.form.adTimeStart = this.form.adTime[0];
this.form.adTimeEnd = this.form.adTime[1];
},
更多推荐
所有评论(0)