0.0.1 • Published 3 years ago

tenantui v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

特色

安装

npm i tenant -S

快速开始

import { createApp } from 'vue';
import { Demo } from 'tenant';
import 'tenant/lib/Demo/index.css';

const app = createApp();
app.use(Demo);

按需加载

  • vite
# 安装 vite 按需加载的包 vite-plugin-imp
npm i -D vite-plugin-imp

# 在 vite.config.js 中配置依赖, 注意组件名称(name)会被转换成 小写横线的形式如: HelloWorld -> hello-world 需要转换成驼峰

{
  ...
  plugins: [
    ...
    vitePluginImp({
      libList: [
        {
          libName: 'tenantui',
          style(name) {
            return `tenantui/lib/${name}/style/index.css`
          }
        },
      ]
    }),
    ...
  ]
}
  • vue-cli
# 安装 vue-cli 按需加载的包 babel-plugin-import
npm i -D vite-plugin-imp

# 在 babel.config.js 中配置依赖, 注意组件名称(name)会被转换成 小写横线的形式如: HelloWorld -> hello-world 需要转换成驼峰

module.exports = {
  presets: [
    '@vue/cli-plugin-babel/preset'
  ],
  plugins: [
    ['import', {
      libraryName: 'tenant',
      libraryDirectory: 'lib',
      style: (name) => `tenant/lib/${name}/style/index.css`
    }]
  ]
}

Browser Support

-

Links