关于引入第三方组件问题
9188 opened this issue · 6 comments
9188 commented
类似 wepy-com-toast 包, 是一个npm
包中只包含一个组件,
请问一个npm里面有多个组件的形式支持吗?
比如我的包cy 目录如下
├── button.wpy
├── toast.wpy
├── package.json
import button from 'cy/button'
import button from 'cy/toast'
mac
上没问题
window
上面依然报错 说找不到 'cy/button'
Gcaufy commented
理论上是可以的。。具体是哪个库。我去测试一下看看。
9188 commented
可以用下面这个库试试
npm i cyw --save
<loadings />
import loadings from 'cyw/Loading'
this.$invoke('loadings', 'show')
this.$invoke('loadings', 'hide')
idseventeen commented
同问,也卡在这个地方了
idseventeen commented
看了你的组件库目录结构,按照vue的组件开发思路,不是应该有个index.js文件里导出么?例如:
// index.js 组件导出文件
import Button from 'path/to/button'
import Dialog from 'path/to/dialog'
export {
Button,
Dialog
}
使用方式:
// page.wpy
<template>
<Button></Button>
</template>
<script>
import wepy from 'wepy'
import { Button } from 'path/to/uikit'
export default class Page extends wepy.page {
commponets = {
Button
}
}
</script>
我遇到的问题是
这样引入第三方组件,执行 wepy build
组件库的代码并未编译,仅将 index.js
文件拷贝至 dist/npm/{uikit}
目录下
截图
@Gcaufy 还望抽空能帮忙解答一下,谢谢!
HEYEggplant commented
请问你的问题解决了吗 我自己的多项目共用模块 也是这个问题找不到文件
stale commented
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
因为这个 Issue 最近没有任何有效回复,所以被自动标记为了stale
。 如果在未来7天依旧没有任何激活操作,那么该 Issue 将会被自动关闭。 感谢您的提问。