I would like to apply a computed style to an input form. The documentation explains how to do that, but only for simple styles.
I need to apply the equivalent of
input[type="text"], textarea {
background-color : red;
}
but it is not clear for me how to convey the [type="text"] bit.
Using it verbatim does not work:
var vm = new Vue({
el: "#root",
data: {
password: '',
},
computed: {
passwordStyle: function() {
var style = {}
style['input[type="text"]'] = 'red';
style['textarea'] = 'blue';
return style;
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.10/vue.min.js"></script>
<div id="root>">
<input type="text" name="password" autofocus="true" v-bind:style='passwordStyle'>
</div>