app.json中加入
"usingComponents": {
"van-button": "@vant/weapp/button/index",
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index",
"van-calendar": "@vant/weapp/calendar/index",
"van-field": "@vant/weapp/field/index",
"van-swipe-cell": "@vant/weapp/swipe-cell/index",
"van-collapse": "@vant/weapp/collapse/index",
"van-collapse-item": "@vant/weapp/collapse-item/index",
"van-count-down": "@vant/weapp/count-down/index",
"van-nav-bar": "@vant/weapp/nav-bar/index",
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"van-tabbar": "@vant/weapp/tabbar/index",
"van-tabbar-item": "@vant/weapp/tabbar-item/index",
"van-notice-bar": "@vant/weapp/notice-bar/index",
"van-tag": "@vant/weapp/tag/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index",
"van-divider": "@vant/weapp/divider/index",
"van-icon": "@vant/weapp/icon/index",
"van-toast": "@vant/weapp/toast/index",
"van-popup": "@vant/weapp/popup/index",
"van-notify": "@vant/weapp/notify/index"
}
wxml页面中
得加入<van-toast id="van-toast" /> 不加入也不弹出
<van-toast id="van-toast" />
<button bindtap="tandemo">点击我</button>
js文件中引入
引入路径要去掉官方写的dist 否则会报错
@vant/weapp/dist
import Toast from '@vant/weapp/toast/toast'
tandemo() {
Toast({
message:'提示的内容',
duration:3000
});
},
网友评论