当前位置:   article > 正文

在原生小程序 vue,mpvue中关于vant组件库的引入的那些坑_van-transition 不生效

van-transition 不生效

原生小程序中引入vant框架的方法

先在项目文件下 cmd进入终端
npm init -y 生成一个package-lock.json文件 进行初始化项目配置
引入vant 包 :npm install vant --save
或者npm i @vant/weapp -S --production

然后在详情中勾选下列选项
这里es6转es5可勾可不勾
一定要勾选使用npm模块

然后在开发者工具中 工具–>构建npm
接下来就可以看到一个 miniprogram_npm的文件夹
在这里插入图片描述
在app.json中或者index.json中添加 配置

 "usingComponents": {
   
    "van-button": "@vant/weapp/button/index",
     "van-slider":"@vant/weapp/slider/index",
     "van-tree-select":"@vant/weapp/tree-select/index",
     "van-popup": "@vant/weapp/popup/index",
     "van-cell": "@vant/weapp/cell/index",
     "van-cell-group": "@vant/weapp/cell-group/index",
     "van-icon": "@vant/weapp/icon/index",
     "van-image": "@vant/weapp/image/index",
     "van-row": "@vant/weapp/row/index",
     "van-col": "@vant/weapp/col/index",
     "van-transition": "@vant/weapp/transition/index",
     "van-calendar": "@vant/weapp/calendar/index",
     "van-uploader": "@vant/weapp/uploader/index",
     "van-action-sheet": "@vant/weapp/action-sheet/index",
     "van-goods-action": "@vant/weapp/goods-action/index",
     "van-goods-action-icon": "@vant/weapp/goods-action-icon/index",
     "van-goods-action-button": "@vant/weapp/goods-action-button/index",
     "van-submit-bar": "@vant/weapp/submit-bar/index",
     "van-grid": "@vant/weapp/grid/index",
     "van-grid-item": "@vant/weapp/grid-item/index"
     
  },

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25

在index.wxml中引入组件


<van-slider value="50" bar-height="4px" active-color="#ee0a24" />
<van-cell title="展示弹出层" is-link bind:click="showPopup" />
<van-popup
  show="{
    { show }}"
  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/325818
推荐阅读
相关标签
  

闽ICP备14008679号