electron-vue中使用iview 报错this. is readonly的解决办法

2023-02-17,,,,


title: electron-vue中使用iview 报错this. is readonly解决办法
toc: false
date: 2019-02-12 19:33:28
categories:

Web

tags:

vue
iview


报大段xxx is readonly的解决办法

修改.electron-vue文件夹中的webpack.renderer.config.js内第22行的

let whiteListedModules = ['vue']

为:

let whiteListedModules = ['vue', 'iview']

即可。

原理:

.electron-vue/webpack.renderer.config.js

Targets electron's renderer process. This configuration handles your Vue application, so it includes vue-loader and many other configurations that are available in the official vuejs-templates/webpack boilerplate.

White-listing Externals

One important thing to consider about this config is that you can whitelist specific modules to not treat as webpack externals. There aren't many use cases where this functionality is needed, but for the case of Vue UI libraries that provide raw *.vue components they will need to be whitelisted, so vue-loader is able to compile them. Another use case would be using webpack aliases, such as setting vue to import the full Compiler + Runtime build. Because of this, vue is already in the whitelist.

参考链接: https://github.com/iview/iview/issues/2513

electron-vue中使用iview 报错this. is readonly的解决办法的相关教程结束。

《electron-vue中使用iview 报错this. is readonly的解决办法.doc》

下载本文的Word格式文档,以方便收藏与打印。