There are two reasons for this error:
1. Misspelling of instruction words
2. Vue.Directive() is not written before new Vue
// Wrong
import Vue from 'vue';
import App from './app.vue';
new Vue({
render: h => h(App),
}).$mount('#A-demo');
Vue.directive('focus', {
inserted(el){
el.focus();
}
})
// Right
import Vue from 'vue';
import App from './app.vue';
Vue.directive('focus', {
inserted(el){
el.focus();
}
})
new Vue({
render: h => h(App),
}).$mount('#A-demo');
Read More:
- [Solved] Vue Error: Failed to resolve directive: scroll-to
- [Solved] Vant quoted lazload error: Failed to Resolve directive: lazy
- [Solved] Vue2.x vue-lazyload Error: Failed to resolve directive: lazy
- [Solved] Vue3 Error: Failed to resolve component:xxx
- How to Deal With the Error: ‘v-slot’ directive doesn’t support any modifier
- Failed to resolve async component default: ChunkLoadError: Loading chunk 7 failed
- [Solved] ERROR in ./src/main.ts Module not found: Error: Can‘t resolve ‘xxx‘
- [Solved] Yapi Secondary deploy error: xxx validation failed: mock: Path `xxx` is required
- Vue3.0 error: Failed to resolve component el-form-item (el element to be unable to be displayed)
- [Solved] react-quill failed to install error: Could not resolve dependency
- Vue Import element-plus Error: Failed to resolve import “element-pluslibtheme-chalkindex.css“ from “src
- [Solved] vue3vite Error: Failed to resolve import “@vue/server-renderer from “src\App.vue“. Does the file exist
- [Vue Run Error] Module build failed: Error: Couldn‘t resolve parser “babylon“
- Vue3.0 Use el-dialog visible Error: ‘.sync‘ modifier on ‘v-bind‘ directive is deprecated. Use ‘v-model:pro
- Vue: How to Solve error avoided redundant navigation to current location: “/xxx”
- [Solved] Npm install Error: verbose stack Error: unable to resolve dependency tree
- Vue elementui: solution for error: avoided redundant navigation to current location: “/xxx”
- Module not found: Error: Can‘t resolve ‘core-js/modules/es.promise.js‘ in
- [Solved] Uncaught (in promise) TypeError: XXX.a is not a constructor
- [Solved] Vue-cli Error: Module not found: Error: Can‘t resolve ‘vue-router ‘