@el-plus/ui 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # el-plus
2
2
 
3
+ ## 0.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - docs: README.md
8
+
3
9
  ## 0.0.4
4
10
 
5
11
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # Fang Common
2
+
3
+ 基于 pnpm workspace + ts + element-plus 开发
4
+
5
+ ## 完整引入
6
+
7
+ ```bash
8
+ import ElPlus from 'el-plus'
9
+ import 'el-plus/dist/index.css'
10
+ app.use(ElPlus)
11
+ ```
12
+
13
+ ### Volar 支持
14
+ 如果您使用 Volar,请在 tsconfig.json 中通过 compilerOptions.type 指定全局组件类型。
15
+
16
+ ```
17
+ {
18
+ "compilerOptions": {
19
+ // ...
20
+ "types": ["el-plus/global"]
21
+ }
22
+ }
23
+ ```
24
+ ## 按需导入方式1 (<b style="color:red">简单</b>)
25
+ ```js
26
+ // main.ts
27
+ import 'el-plus/dist/index.css' // 引入所有样式
28
+ // xx.vue
29
+ import { ElButtons } from 'el-plus'
30
+
31
+ ```
32
+ ## 按需导入导入方式2 (待增加)
33
+ 您需要使用额外的插件来导入要使用的组件。
34
+ ### 自动导入 (<b style="color:red">推荐</b>)
35
+ 首先你需要安装[`unplugin-vue-components`](https://github.com/unplugin/unplugin-vue-components#installation) 和 [`unplugin-auto-import`](https://github.com/unplugin/unplugin-auto-import#install)这两款插件
36
+ ``` bash
37
+ $ npm install -D unplugin-vue-components unplugin-auto-import
38
+ ```
39
+ 然后把下列代码插入到你的 Vite 或 Webpack 的配置文件中
40
+
41
+ ```js
42
+ import { defineConfig } from 'vite'
43
+ import AutoImport from 'unplugin-auto-import/vite'
44
+ import Components from 'unplugin-vue-components/vite'
45
+ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
46
+
47
+ export default defineConfig({
48
+ // ...
49
+ plugins: [
50
+ // ...
51
+ AutoImport({
52
+ resolvers: [ElementPlusResolver()],
53
+ }),
54
+ Components({
55
+ resolvers: [ElementPlusResolver()],
56
+ }),
57
+ ],
58
+ })
59
+
60
+ ```
61
+ ### 手动导入
62
+ 在vue文件中import即可,但需要安装 `unplugin-element-plus` 来导入样式,配置文档参考[docs](https://github.com/element-plus/unplugin-element-plus#readme)
63
+ ``` js
64
+ <template>
65
+ <el-button>I am ElButton</el-button>
66
+ </template>
67
+
68
+ <script>
69
+ import { ElButton } from 'element-plus'
70
+
71
+ export default {
72
+ components: { ElButton },
73
+ }
74
+ </script>
75
+ ```
76
+ ```js
77
+ import { defineConfig } from 'vite'
78
+ import ElementPlus from 'unplugin-element-plus/vite'
79
+
80
+ export default defineConfig({
81
+ // ...
82
+ plugins: [ElementPlus({
83
+ lib:'el-plus'
84
+ })],
85
+ })
86
+ ```
87
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@el-plus/ui",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "pro base on element-plus",
5
5
  "module": "index.ts",
6
6
  "keywords": [