PeakTai / vue-html5-editor

An html5 wysiwyg editor for vue
Apache License 2.0
949 stars 247 forks source link

各位大佬, 问下 VueHtml5Editor 为啥初始化报错, #156

Open luo963827954 opened 4 years ago

luo963827954 commented 4 years ago

引入方式 import VueHtml5Editor from 'vue-html5-editor'; Vue.use(VueHtml5Editor)

组件使用方式 vue-html5-editor :content="content" :height="500"

报错信息

[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

found in

--->

at src/App.vue warn @ vue.runtime.esm.js?2b0e:619 mountComponent @ vue.runtime.esm.js?2b0e:4029 Vue.$mount @ vue.runtime.esm.js?2b0e:8415 init @ vue.runtime.esm.js?2b0e:3118 createComponent @ vue.runtime.esm.js?2b0e:5978 createElm @ vue.runtime.esm.js?2b0e:5925 createChildren @ vue.runtime.esm.js?2b0e:6053 createElm @ vue.runtime.esm.js?2b0e:5954 patch @ vue.runtime.esm.js?2b0e:6477 Vue._update @ vue.runtime.esm.js?2b0e:3945 updateComponent @ vue.runtime.esm.js?2b0e:4066 get @ vue.runtime.esm.js?2b0e:4479 Watcher @ vue.runtime.esm.js?2b0e:4468 mountComponent @ vue.runtime.esm.js?2b0e:4073 Vue.$mount @ vue.runtime.esm.js?2b0e:8415 init @ vue.runtime.esm.js?2b0e:3118 createComponent @ vue.runtime.esm.js?2b0e:5978 createElm @ vue.runtime.esm.js?2b0e:5925 patch @ vue.runtime.esm.js?2b0e:6516 Vue._update @ vue.runtime.esm.js?2b0e:3945 updateComponent @ vue.runtime.esm.js?2b0e:4066 get @ vue.runtime.esm.js?2b0e:4479 Watcher @ vue.runtime.esm.js?2b0e:4468 mountComponent @ vue.runtime.esm.js?2b0e:4073 Vue.$mount @ vue.runtime.esm.js?2b0e:8415 eval @ main.js?56d7:12 ./src/main.js @ app.js:945 __webpack_require__ @ app.js:785 fn @ app.js:151 1 @ app.js:958 __webpack_require__ @ app.js:785 checkDeferredModules @ app.js:46 (anonymous) @ app.js:861 (anonymous) @ app.js:864 Show 4 more frames vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in mounted hook: "TypeError: Cannot set property 'innerHTML' of undefined" found in ---> at src/App.vue warn @ vue.runtime.esm.js?2b0e:619 logError @ vue.runtime.esm.js?2b0e:1884 globalHandleError @ vue.runtime.esm.js?2b0e:1879 handleError @ vue.runtime.esm.js?2b0e:1839 invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1862 callHook @ vue.runtime.esm.js?2b0e:4219 insert @ vue.runtime.esm.js?2b0e:3139 invokeInsertHook @ vue.runtime.esm.js?2b0e:6346 patch @ vue.runtime.esm.js?2b0e:6565 Vue._update @ vue.runtime.esm.js?2b0e:3945 updateComponent @ vue.runtime.esm.js?2b0e:4066 get @ vue.runtime.esm.js?2b0e:4479 Watcher @ vue.runtime.esm.js?2b0e:4468 mountComponent @ vue.runtime.esm.js?2b0e:4073 Vue.$mount @ vue.runtime.esm.js?2b0e:8415 eval @ main.js?56d7:12 ./src/main.js @ app.js:945 __webpack_require__ @ app.js:785 fn @ app.js:151 1 @ app.js:958 __webpack_require__ @ app.js:785 checkDeferredModules @ app.js:46 (anonymous) @ app.js:861 (anonymous) @ app.js:864 vue.runtime.esm.js?2b0e:1888 TypeError: Cannot set property 'innerHTML' of undefined at VueComponent.mounted (vue-html5-editor.js?c097:1254) at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854) at callHook (vue.runtime.esm.js?2b0e:4219) at Object.insert (vue.runtime.esm.js?2b0e:3139) at invokeInsertHook (vue.runtime.esm.js?2b0e:6346) at Vue.patch [as __patch__] (vue.runtime.esm.js?2b0e:6565) at Vue._update (vue.runtime.esm.js?2b0e:3945) at Vue.updateComponent (vue.runtime.esm.js?2b0e:4066) at Watcher.get (vue.runtime.esm.js?2b0e:4479) at new Watcher (vue.runtime.esm.js?2b0e:4468)
lsmtty commented 3 years ago

请问问题结局了吗

renlixin commented 3 years ago

因为他走的是运行时,所以需要修改你的cue.config.js ` module.exports = { runtimeCompiler: true, configureWebpack: config => { config.resolve = { extensions: [".js", ".vue", ".json", ".css"], alias: { vue$: "vue/dist/vue.esm.js", } }; } }

`