<template> <el-select ref="select" @hook:mounted="cancalReadOnly" @visible-change="cancalReadOnly" > </el-select> </template> <script> export default { methods: { cancalReadOnly(onOff) { this.$nextTick(() => { if (!onOff) { const {select} = this.$refs; const input = select.$el.querySelector('.el-input__inner'); input.removeAttribute('readonly'); } }); } } } </script> https://my.oschina.net/u/560237/blog/4891996 |
|