1、表格超出顯示省略號
:show-overflow-tooltip='true'
//過長樣式修改
.el-tooltip__popper{
max-width:20%;
}
.el-tooltip__popper,.el-tooltip__popper.is-dark{
background:rgb(48, 65, 86) !important;
color: #fff !important;
line-height: 24px;
}
2、表單添加紅色星號,但是不會校驗
:required="true"
3、下拉框有值卻無法選中的問題
@change="change()"
change(){
this.$forceUpdate()
},
4、選擇框禁止選中
:selectable="checkSelectable"
checkSelectable(row) {
return row.date == '2016-05-03'
}
//若返回為 true, 則可以選中,否則禁止選中
5、el-input輸入框字符限制,只顯示英文及數(shù)字
<el-input v-model="accountVal" maxlength="24" @input="accountInput" placeholder="請輸入用戶賬號"></el-input>
//通過監(jiān)控輸入框的事實輸入,來進行正則盼盼重新賦值處理
accountInput(val){//賬號的實時輸入
let codeReg = new RegExp("[A-Za-z0-9]+") //正則 英文+數(shù)字;
let len= val.length
let str= ''
for(var i=0;i<len;i++){
if(codeReg.test(val[i])){
str+=val[i];
}
}
this.accountVal=str;
},
6.element-ui checkbox 設(shè)置選中為1,未選中為0
<el-checkbox v-model="data" :true-label="1" :false-label="0"></el-checkbox>
7.vue組件中props類型及默認(rèn)值
props: {
String: {
type: String,
default: ''
},
Number: {
type: Number,
default: 0
},
Boolean: {
type: Boolean,
default: true
},
Array: {
type: Array,
default: () => []
},
Object: {
type: Object,
default: () => ({})
},
Function: {
type: Function,
default: function () { }
}
}