ecomfe / okam

Mini program development framework
https://ecomfe.github.io/okam
MIT License
416 stars 65 forks source link

是否支持第三方小程序组件库 #6

Closed yinLiangDream closed 5 years ago

yinLiangDream commented 5 years ago

有时候需要用到第三方的组件库,文档里没有写明是否支持。

xhong0 commented 5 years ago

具体场景是? 比如:特定小程序引入同一第三方组件还是跨小程序引用?

  1. 对于开发特定小程序引入同一第三方库情况是可以的, eg:开发微信小程序时引入微信小程序第三方库: xxxx ui 库 ; 使用方式:跟本地自定义组件一样,在 <script>import 然后 在 components 上正常声明即可,

    <template>
    <view>
        <ui-button type="primary" @click="handleClick">按钮</ui-button>
    </view>
    </template>
    <script>
    // 此路径 ui 库引用一致
    import button from 'xxxx/dist/button'; 
    export default {
    //  ...
    components: {
        'ui-button': button
    },
    // ...
    methods: {
        handleClick() {
            // ...
        }
    }
    };
    </script>
  2. 对于跨小程序引用 暂时不支持