一.创建项目
(1) npm install -g @tarojs/cli
(2) npx @tarojs/cli init myApp
二.按需引入 nutui 组件
1.使用 babel-plugin-import插件
(1)下载插件 npm install babel-plugin-import
(2) babel.config.js配置文章来源:https://www.toymoban.com/news/detail-483150.html
plugins: [
[
'import',
{
libraryName: '@nutui/nutui-taro',
libraryDirectory: 'dist/packages/_es',
customName: (name, file) => {
if (name == 'Locale') {
return '@nutui/nutui-taro/dist/packages/locale/lang';
} else {
return `@nutui/nutui-taro/dist/packages/_es/${name}`;
}
},
style: (name, file) => name.toLowerCase().replace('_es/', '') + '/index.scss',
camel2DashComponentName: false,
},
'nutui3-taro',
],
(3)app.js中引入文章来源地址https://www.toymoban.com/news/detail-483150.html
import { crea
到了这里,关于taro+vue3开发小程序的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!