1.首先是循环格式
vue 中 js方面的
a.forEach((item,index)=>{
item. 干啥干啥干啥
})
a 是集合 数组 方面
index 是下标
item == for循环中的 i
2.按钮的隐藏和显现(运用判断)
比如 这个 是一个 保存邮件发送按钮 <el-button></el-button>
<el-button size="small" type="primary" @click="confirmSubmitFormAndSend('ruleForm')" :style="{ display: saveEmailButton } " plain>保存并发送邮件</el-button>
其次 重要的 是 :style="{ display: saveEmailButton }
这个 display 是属性 这个saveEmailButton是参数
然后再 data() {return{ }} 层声明
return { saveEmailButton:'', }
最后在你用的方法里判断(这里用的是三目运算)
//保存 并发送 邮箱只有超级管理员可以 看到 this.saveEmailButton = role=="superAdmin"?'':'none';
this.saveEmailButton 这个是刚才的参数
role是 我本地获取 的 角色
意思就是 参数 = 角色==超级管理员就复制 为空(也就是不隐藏)
反之不是超级管理员就 赋值none 也就是隐藏参数了
3.属性
1.@Input="写方法()" (这个可以用在 输入框 和 多选框 只要值变动就会触发)
2.debugger 前端vue 断点调试
3.<el-table></el-table> 添加表头背景颜色
:header-cell-style="{background:'oldlace',color:'oldlace'}" color 是字体颜色
解决边距问题
(71条消息) CSS里,边距(Margin),边框样式(border),空白(Padding)的相关参数_tedbirkar的博客-CSDN博客
了解vue中数组的多种方法
(72条消息) vue之push() pop() shift() unshift() splice() sort() reverse()等等_autm许的博客-CSDN博客
4.回车执行方法
//支持回车查询
document.οnkeydοwn=e=>{
let _key=window.event.keyCode;
if(_key===13){
填入你要执行的方法比如我调用查询所有方法 this.findByPage()
}
}
5.input 大写转换
@input="query.warehouseNameCn = query.warehouseNameCn.toUpperCase()"
query.warehouseNameCn 和 v-model 中的值一致