ref快速定位
<span style:"color:red;visibility:hidden" ref='input1'>*</span>
<el-input v-model="uname" @blur="checkIsNull"></el-input>
<span style:"color:red;visibility:hidden" ref='input2'>*</span>
<el-input v-model="upwd" @blur="checkIsNull"></el-input>
<script>
checkIsNull(param) {
if (param == 1) {
if (uname == "") {
this.$refs.input1.style.visibility = 'visible'
} else {
this.$refs.input1.style.visibility = 'hidden'
}
if (param == 2) {
if (upwd == "") {
this.$refs.input2.style.visibility = 'visible'
} else {
this.$refs.input3.style.visibility = 'hidden'
}
}
</script>