vue里input根据value改变背景色的实例
时间:2021-05-12 09:09:48|栏目:vue|点击: 次
1、首先定义两个不同的
.null-input .el-input__inner {
background-color: rgba(255, 255, 255, 0.8);
color: #525661;
font-size: 16px;
}
.no-null-input .el-input__inner {
background-color: rgba(255, 255, 255, 1);
color: #524F52;
font-size: 16px;
}
2、根据:class 控制input的class
:class="{ 'null-input':isNullInput, 'no-null-input':!isNullInput}" @change="changeCss"
3、根据change方法判断input的值 然后控制isNullInput的值
changeCss(val) {
if (val === "") {
this.isNullInput = true;
} else {
this.isNullInput = false;
}
console.log(this.isNullInput);
}
但是关于placeholder颜色无法改变
网上的方法试了 没有效果--网上方法:input::-webkit-input-placeholder
上一篇:vue实现图片上传预览功能
栏 目:vue
下一篇:基于vue-simple-uploader封装文件分片上传、秒传及断点续传的全局上传插件功能
本文地址:http://www.codeinn.net/misctech/119625.html






