当前位置:   article > 正文

uni-app整合vant、nuxt_uniapp 整合 vant

uniapp 整合 vant

uni-app整合vant

前言

vant ui有h5版和微信小程序版。其h5版只能用于h5,其微信小程序版(vant weapp)可用于微信和App,从uni-app 2.4.7起,H5和QQ小程序也支持了微信小程序组件

使用步骤

下载代码

  • 在项目根目录下新建 wxcomponents 目录 ,此目录应该与components 目录同级。

  • 直接通过 git 下载 vant-weapp 最新源代码,并将dist目录拷贝到新建的wxcomponents目录下,并重命名distvant-weapp

  • 在 pages.json 的 globalStyle 中 引入所需要的组件

    1. "globalStyle": {
    2. "pageOrientation": "portrait",
    3. "navigationBarTitleText": "Hello uniapp",
    4. "navigationBarTextStyle": "white",
    5. "navigationBarBackgroundColor": "#007AFF",
    6. "backgroundColor": "#F8F8F8",
    7. "backgroundColorTop": "#F4F5F6",
    8. "backgroundColorBottom": "#F4F5F6",
    9. "usingComponents": { //这里为方便,全局引入了所有组件,也可以在某个page下单独引用某个组件
    10. "demo-block": "/wxcomponents/vant/demo-block/index",
    11. "van-action-sheet": "/wxcomponents/vant/action-sheet/index",
    12. "van-area": "/wxcomponents/vant/area/index",
    13. // "van-badge": "/wxcomponents/vant/badge/index",
    14. // "van-badge-group": "/wxcomponents/vant/badge-group/index",
    15. "van-button": "/wxcomponents/vant/button/index",
    16. "van-card": "/wxcomponents/vant/card/index",
    17. "van-cell": "/wxcomponents/vant/cell/index",
    18. "van-cell-group": "/wxcomponents/vant/cell-group/index",
    19. "van-checkbox": "/wxcomponents/vant/checkbox/index",
    20. "van-checkbox-group": "/wxcomponents/vant/checkbox-group/index",
    21. "van-col": "/wxcomponents/vant/col/index",
    22. "van-dialog": "/wxcomponents/vant/dialog/index",
    23. "van-field": "/wxcomponents/vant/field/index",
    24. "van-goods-action": "/wxcomponents/vant/goods-action/index",
    25. "van-goods-action-icon": "/wxcomponents/vant/goods-action-icon/index",
    26. "van-goods-action-button": "/wxcomponents/vant/goods-action-button/index",
    27. "van-icon": "/wxcomponents/vant/icon/index",
    28. "van-loading": "/wxcomponents/vant/loading/index",
    29. "van-nav-bar": "/wxcomponents/vant/nav-bar/index",
    30. "van-notice-bar": "/wxcomponents/vant/notice-bar/index",
    31. "van-notify": "/wxcomponents/vant/notify/index",
    32. "van-panel": "/wxcomponents/vant/panel/index",
    33. "van-popup": "/wxcomponents/vant/popup/index",
    34. "van-progress": "/wxcomponents/vant/progress/index",
    35. "van-radio": "/wxcomponents/vant/radio/index",
    36. "van-radio-group": "/wxcomponents/vant/radio-group/index",
    37. "van-row": "/wxcomponents/vant/row/index",
    38. "van-search": "/wxcomponents/vant/search/index",
    39. "van-slider": "/wxcomponents/vant/slider/index",
    40. "van-stepper": "/wxcomponents/vant/stepper/index",
    41. "van-steps": "/wxcomponents/vant/steps/index",
    42. "van-submit-bar": "/wxcomponents/vant/submit-bar/index",
    43. "van-swipe-cell": "/wxcomponents/vant/swipe-cell/index",
    44. "van-switch": "/wxcomponents/vant
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/539939
推荐阅读