elementui 时间组件怎么让他只显示左右切换 不显示时间选择面板。变成这样
帮帮忙
看这里---------
<template>
<el-time-picker
v-model="time"
:picker-options="pickerOptions"
:placeholder="placeholder"
></el-time-picker>
</template>
<script>
export default {
data() {
return {
time: '', // 绑定的时间值
pickerOptions: {
format: 'HH:mm', // 时间格式
type: 'time' // 只显示时间选择
},
placeholder: '请选择时间' // 输入框的提示文字
};
}
};
</script>
使用 picker-options 属性进行配置。设置 picker-options 的 format 为 'HH:mm',并将 type 设置为 'time'。这样可以只显示时间选择的小时和分钟部分,隐藏日期选择和秒部分。
你直接看他源码是怎么写的就行,他有这个功能
活动修改分为回显和修改
一、活动修改api
//根据id查询活动
findById:function(id){
return request({
url: `/gathering/gathering/${id}`,
method: 'get'
})
},
//根据id修改
update:function(id,pojo){
return request({
url: `/gathering/gathering/${id}`,
method: 'put',
data:pojo
})
},
saveOrUpdate:function(id,pojo){
if(id == undefined || id == null || id == ''){
return this.save(pojo)
}else{
return this.update(id,pojo)
}
}
二、js
注意:保存和修改使用同一个对话框,通过是否存在id来区分两个方法
//新增/编辑活动
save:function(){
gatheringApi.saveOrUpdate(this.id,this.pojo).then(response =>{
//美化提示框
this.$message({
showClose: true,
message: response.message,
type: response.flag?'success':'error'
});
//新增成功后,关闭弹出层,刷新列表数据,清空pojo数据
if(response.flag){
this.dialogFormVisible=false;
this.searchPage();
this.pojo={};
this.id=null;
}
})
},
//编辑活动之回显
findById:function(id){
gatheringApi.findById(id).then(response =>{
//绑定数据到pojo
this.pojo = response.data;
//显示对话框
this.dialogFormVisible=true;
//给id属性赋值
this.id = id;
})
}