Ant-design-vue: 在electron-vue下modal无法使用

Created on 3 Sep 2018  ·  13Comments  ·  Source: vueComponent/ant-design-vue


按照官方的文档的写法使用后,点击没有任何效果,也不会报错,很尴尬
lh 6zl tqrqu86ws_m8j

pt8 t vj3j aw4ov r3sf

Most helpful comment

@webees 改一下配置就可以了,这个锅不是 ant-design-vue 的,找到 .electron-vue/webpack.renderer.config.jsant-design-vue 加入到白名单

/**
 * List of node_modules to include in webpack bundle
 *
 * Required for specific packages like Vue UI libraries
 * that provide pure *.vue files that need compiling
 * https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
 */
let whiteListedModules = ['vue', 'ant-design-vue']

Electron-Vue 有文档说明这个问题 https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals

All 13 comments

最好给出复现链接,方便定位问题

  1. 全局安装vue-cli
  2. vue init simulatedgreg/electron-vue electron-vue
  3. cd electron-vue
  4. yarn
  5. yarn add ant-design-vue
  6. main.js中添加
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/antd.css'
Vue.use(Antd)
  1. 从官网复制粘贴相关代码即可完成复现

@iczer

已测试,在electron-vue中大部分组件都无法正常使用

调用modal不会报错,直接打印会显示TypeError: 'caller' and 'arguments' are restricted function properties and cannot be accessed in this context.

_20180904145758

tim 20180904145617
每执行this.$error()会插入两个div空节点。

复现代码:

_20180904145723

刚试了下,我这里是正常的,win10
image

<template>
    <div>
        <a-button @click="open">click me</a-button>
    </div>
</template>
<script>
export default {
  name: 'Modal',
  methods: {
    open () {
      this.$success({
        title: 'hello',
        content: 'hello world'
      })
    }
  }
}
</script>

@iczer 你关闭重新run dev一下呢,我也成功过一次。

重启确实不行了,等官方给适配吧

这里有个方案可以解决 #134
或者使用按需加载也可以

@webees 改一下配置就可以了,这个锅不是 ant-design-vue 的,找到 .electron-vue/webpack.renderer.config.jsant-design-vue 加入到白名单

/**
 * List of node_modules to include in webpack bundle
 *
 * Required for specific packages like Vue UI libraries
 * that provide pure *.vue files that need compiling
 * https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
 */
let whiteListedModules = ['vue', 'ant-design-vue']

Electron-Vue 有文档说明这个问题 https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals

谢谢大神解答!

谢谢,麻烦你们了

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

Was this page helpful?
0 / 5 - 0 ratings