我正在使用https://element.eleme.io/#/ 我在每个列表页中都面临着
答案 0 :(得分:1)
Vue.directive('custom', {
inserted: function(el) {
el.style.backgroundColor = 'orange'
}
})
var app = new Vue({
el: '#app'
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<input v-custom type="text">
<input v-waves type="text">
<!-- The `v-waves` directive will have the same error -->
</div>
原因是没有注册自定义指令。有关自定义指令的更多用法,请please see here。