taro+vue3开发小程序

一.创建项目

(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配置

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中引入

import { crea

你可能感兴趣的:(vue,taro,vue3,nutui)