<body>
<div class="container">
<div id="app">
<h3 v-color="'red'">{{ msg }}</h3>
<input type="text" class="form-control" v-model="msg" v-focus>
</div>
</div>
<script>
Vue.directive('focus', {
inserted: function (el) {
el.focus();
}
});
var vm = new Vue({
el: "#app",
data: {
msg: '',
},
directives: {
color: function (el, binding) {
el.style.color = binding.value
}
}
})
</script>
</body>
vue9.20
最新推荐文章于 2024-02-06 11:16:08 发布