1,引用时间控件的时候要记得赋值
<el-date-picker v-model="listQuery.onlineTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
label-width="10px"
placeholder="yyyy-mm-dd 00:00:00" **@change="startTimeStatus"**
style="margin-right: 10px;width:300px;float:left;" :disabled="checkCouponDis">
</el-date-picker>
methods(){
// 时间开始选择器
startTimeStatus: function (value) {
this.listQuery.onlineTime = value
},
}
2,你有一个list,里面有code和code对应的value,后端返给你code,怎么取到相应的value呢?
<el-table-column label="场景" align="center" prop="scene" **:formatter="formatterScene**">
</el-table-column>
methods(){
formatterScene(row, column) {
if(Array.isArray(this.sceneList) && this.sceneList.length > 0) {
for (let sceneObj of this.sceneList) {
if (sceneObj.dataCode == row.scene) {
return sceneObj.dataValue;
}
}
}
},
}
注意:第二段代码中sceneList就是你已经获得的list
三:怎么知道用户点击的是确定还是取消?
methods: {
//保存卡券信息
getList(){
this.$confirm('保存后业务线规则不可更改,确定保存吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
fetchList(this.listQuery).then(response => {
if (response.code =='2000'){
this.$message({type: 'success', message: '保存成功!'});
var saveFlag = "false";
setSaveFlag(saveFlag)
this.$router.push("/couponsSystem/couponsManage/couponsList/index");
}else {
this.$message({type: 'error', message:response.message});
}
setTimeout(() => {
this.listLoading = false
}, 2.5 * 1000)
})//到这是点击确定后执行的代码
}).catch(() => {
//这里可以写点击取消之后需要执行的代码
});
},
}
上面这段代码:点确定的时候才会执行then后面的代码,如果点击取消,执行的是catch(() => {
})
这里面的代码,如果你点击取消之后需要写一些代码,可以写在catch里面
即总结:点击确定走then。点击取消走 catch
注意:如果你想看点的确定还是取消,去获取这个结果值的话,以下网页地址有解答:
https://zhidao.baidu.com/question/206131268.html
版权声明:本文为weixin_43228497原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。