Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build出来的的umd使用报错 #780

Closed
iqiuye opened this issue Jan 18, 2017 · 4 comments
Closed

build出来的的umd使用报错 #780

iqiuye opened this issue Jan 18, 2017 · 4 comments

Comments

@iqiuye
Copy link

iqiuye commented Jan 18, 2017

我按照文档生产的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这些插件调用方法怎么用
这个问题已经困扰了一天了,请帮忙解答一下

@airyland
Copy link
Owner

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

@iqiuye
Copy link
Author

iqiuye commented Jan 19, 2017

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

@airyland
Copy link
Owner

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

@airyland
Copy link
Owner

参考这里的文档:

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

有问题再反馈。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants