Vux: build出来的的umd使用报错

Created on 18 Jan 2017  ·  4Comments  ·  Source: airyland/vux

我按照文档生产的umd文件,build后的vux.min.js

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>scripts</title>
    <link rel="stylesheet" href="{{ asset('vux/vux.min.css') }}">
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>
<div id="demo">
    <group>
        <cell title="Vue" :value="how"></cell>
    </group>
</div>

<script src="{{ asset('vux/vux.min.js') }}"></script>

<script>
    Vue.component('group', vuxGroup)
    Vue.component('cell', vuxCell)
    new Vue({
        el: '#demo',
        data: {
            how: 'Cool'
        }
    })
</script>
</body>
</html>

会报错

uncaught Error: Cannot find module "./switch"
    at vux.min.js:1
    at Object.<anonymous> (vux.min.js:1)
    at e (vux.min.js:1)
    at t.__esModule.default (vux.min.js:1)
    at vux.min.js:1
    at vux.min.js:1
    at vux.min.js:1
(anonymous) @ vux.min.js:1
(anonymous) @ vux.min.js:1
e @ vux.min.js:1
t.__esModule.default @ vux.min.js:1
(anonymous) @ vux.min.js:1
(anonymous) @ vux.min.js:1
(anonymous) @ vux.min.js:1
base:18 Uncaught ReferenceError: vuxGroup is not defined
    at base:18

还有我引用alert/index.min.js和actionsheet/index.min.js时也会报错,下面是错误(我暂时只试了几个,只有这两个报错)

Uncaught Error: Cannot find module "!!vue-loader/lib/template-compiler?id=data-v-05897776!./../../../node_modules/.1.0.25@vux-loader/src/template-loader.js!vue-loader/lib/selector?type=template&index=0!./index.vue"
    at index.min.js:1
    at Object.<anonymous> (index.min.js:1)
    at t (index.min.js:1)
    at index.min.js:1
    at index.min.js:1
    at index.min.js:1
    at index.min.js:1

不知道是不是我build的问题
我使用的npm版本是4.0.5,nodejs版本是v7.4.0

还有,请问按照script引用的方式调用的话,toast,alert这些插件调用方法怎么用
这个问题已经困扰了一天了,请帮忙解答一下

Most helpful comment

参考这里的文档:

https://vux.li/#/zh-CN/README?id=%E7%BB%84%E4%BB%B6-umd-%E6%96%87%E4%BB%B6
https://vux.li/#/zh-CN/components_dialog?id=alert

有问题再反馈。

All 4 comments

晚一点补充文档并且在vux-dist里添加demo。

@airyland 引入dist/vux.min.css测试时grid样式不正确

如果你的代码不是最新的,构建完的代码没有包含grid。

参考这里的文档:

https://vux.li/#/zh-CN/README?id=%E7%BB%84%E4%BB%B6-umd-%E6%96%87%E4%BB%B6
https://vux.li/#/zh-CN/components_dialog?id=alert

有问题再反馈。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

felixjing picture felixjing  ·  4Comments

LS1231 picture LS1231  ·  3Comments

chengjs picture chengjs  ·  4Comments

hezhiwen940420 picture hezhiwen940420  ·  4Comments

wonghoman picture wonghoman  ·  4Comments