关于taro引进vant组件所遇到的问题

1. 直接将vantweapp克隆到你所在的文件中

2.配置相对应的全局文件映射,官方文档配置的不全,如果能正常启动,在小程序中会报wxml编译错误,

将你需要的组件写在变量中。

 
 { from: 'src/components/vantWeapp/wxs', to: 'dist/components/vantWeapp/wxs' },
      // { from: 'src/components/vantWeapp/common/style', to: 'dist/components/vantWeapp/common/style' },
      // { from: 'src/components/vantWeapp/common/index.wxss', to: 'dist/components/vantWeapp/common/index.wxss' },
      ...importVant([
        'loading',
        { name: 'overlay',  types: ['wxss', 'wxml']},
        'popup',
        'transition',
        { name: 'action-sheet', types: ['wxss', 'wxml'] },
        'cell',
        { name: 'cell-group', types: ['wxss', 'wxml'] },
        'icon',
        'button',
        'checkbox',
        { name: 'checkbox-group', types: ['wxss', 'wxml'] },
        { name: 'dialog', types: ['wxss', 'wxml'] },
        { name: 'image', types: ['wxss', 'wxs'] },
        'tag',
        'switch',
        'uploader',
        'checkbox',
        { name: 'index-bar', types: ['wxss', 'wxml'] },
        { name: 'index-anchor', types: ['wxss', 'wxml'] },
        'picker',
        'picker-column',
        { name: 'slider', types: ['wxss', 'wxml'] },
        'field',
        'empty',
        'notice-bar',
        'radio',
        { name: 'datetime-picker', types: ['wxss', 'wxml'] }
      ])
 

 

 

3.还会遇到taro无法编译的情况,@taro-什么什么错误,可能是版本错误,还有就是 ,反正我是莫名其妙的好了,没有复现
posted @ 2022-08-05 18:03  Mirro_r  阅读(712)  评论(0)    收藏  举报