Vux: [Bug Report] 关于vue/cli3.0引用发现的组件问题:

Created on 7 Sep 2018  ·  5Comments  ·  Source: airyland/vux

VUX version

2.9.2

OS/Browsers version

所有浏览器

Vue version

2.5.17

Code

1.创建好项目后,在cmd中用命令“vue add vux” 安装可以不配做相关配置即可直接使用,
但所有组件都无法在main.js中全局引用,引用后就报错…,
只能局部引用,像loading,alert,cell,group.. 这样各个页面必用的组件只能重复引用,心好累…
2.因为刚开始用,暂时发现 querystring 组件连局部引用都不行,一样报错。
3.各种百度google,说是vue-loader 降级不会报错,但然并卵…

Steps to reproduce

呃,重现步骤是什么鬼?

What is Expected?

vux组件是目前见到功能最全的组件,在项目中可以让效率大大的提高,现在cli3.0已经是正式版,比2.0有很大的改进,不需要做额外的配置,有更友好的视图界面创建项目,希望能够针对cli3.0升级版本…

What is actually happening?

祝vux越做越好…

Most helpful comment

  • 针对第一问回答,如果说在 main.js 全局引用/注册组件的话确实会报错,并且页面加载不出来,所以我的做法是在 App.vue 中注册全局组件,但全局注册会导致包过大,如下:
<script>
  import Vue from 'vue'

  import { XButton } from 'vux'

  Vue.component('x-button', XButton)
</script>
  • ps:萌新勿喷,欢迎讨论,谢谢

All 5 comments

WARNING Compiled with 2 warnings 15:04:15

warning in ./node_modules/vux/src/plugins/locale/index.js

"export 'default' (imported as 'querystring') was not found in '../../tools/querystring'

warning in ./node_modules/vux/index.js

"export 'default' (reexported as 'querystring') was not found in './src/tools/querystring/index.js'

App running at:

以上是在main.js引用组件的报错内容,不管引用哪个组件都是报的这个错,不知道如何屏蔽了…

import Vue from 'vue'
import { AlertPlugin,LoadingPlugin,ToastPlugin } from 'vux'
Vue.use(AlertPlugin,LoadingPlugin,ToastPlugin )

// 像这么引用,点击事件调用会报错 必须 单独写才行,
但像这样单独写的话,设置默认参数不起作用
import { ToastPlugin } from 'vux'
Vue.use(ToastPlugin, {position: 'middle'})
设置默认参数不起作用

  • 针对第一问回答,如果说在 main.js 全局引用/注册组件的话确实会报错,并且页面加载不出来,所以我的做法是在 App.vue 中注册全局组件,但全局注册会导致包过大,如下:
<script>
  import Vue from 'vue'

  import { XButton } from 'vux'

  Vue.component('x-button', XButton)
</script>
  • ps:萌新勿喷,欢迎讨论,谢谢

WARNING Compiled with 1 warnings 14:07:54

warning in ./src/App.vue

"export 'default' (imported as '__vue_script__') was not found in '!!babel-loader!../node_modules/vux-loader/src/script-loader.js!../node_modules/vue-loader/lib/selector?type=script&index=0!./App.vue'

直接在 App.vue 中 引用组件当全局来使用的话, 会有上面的 警告,我觉得还是某些组件有问题

See #3115

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chengjs picture chengjs  ·  4Comments

skyshirt picture skyshirt  ·  4Comments

GloriaCHL picture GloriaCHL  ·  4Comments

felixjing picture felixjing  ·  4Comments

iqiuye picture iqiuye  ·  4Comments