/tracer-ui

一个vue3的pc端组件库,支持按需加载。

Primary LanguageVue

Tracer-UI

一个使用vite2构建的支持vue3的PC端组件库

安装

//npm
npm install tracer-ui
//yarn
yarn add tracer-ui
//pnpm
pnpm install tracer-ui

全量引入

//main.js
import { createApp } from 'vue'
import App from './App.vue'
import tracer from 'tracer-ui'
import 'tracer-ui/lib/style.css'
createApp(App).use(tracer).mount('#app')

按需引入

安装babel-plugin-tracer

  yarn add  babel-plugin-tracer -D 

babel.config.js 中添加配置

module.exports = {
  plugins: [
      ["babel-plugin-tracer", {
        "cssPath": "tracer-ui/lib/style/{key}.css", 
        "jsPath": "tracer-ui/lib/Tracer.es.js",
        "lib": "tracer-ui" 
    }]
  ]
}

然后在main.js中引入

//main.js
import { createApp } from 'vue'
import App from './App.vue'
import {Button} from 'tracer-ui'
createApp(App).use(Button).mount('#app')

单文件组件中直接使用

<template>
  <t-button>tracer-ui</t-button>
</template>