@daxiangme/form-vue 0.1.2 → 0.1.4

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/README.md CHANGED
@@ -20,7 +20,14 @@ pnpm add @daxiangme/form-vue
20
20
  pnpm add @daxiangme/form-vue vue element-plus
21
21
  ```
22
22
 
23
- 按以下顺序引入样式:
23
+ 按需宿主(`unplugin-vue-components` 等)只需引入包自身样式。入口会副作用导入所用 Element Plus 组件的 `style/css`,宿主已有的 `--el-*` 变量和全局 `.el-*` 补丁会作用在设计器上,**不必**全量 `element-plus/dist/index.css`,也**不必** `app.use(ElementPlus)`:
24
+
25
+ ```ts
26
+ import '@daxiangme/form-vue/style.css'
27
+ import { FormDesigner, FormRenderer } from '@daxiangme/form-vue'
28
+ ```
29
+
30
+ 已经全量引入 Element Plus 样式的工程仍然兼容,可继续:
24
31
 
25
32
  ```ts
26
33
  import 'element-plus/dist/index.css'
@@ -30,14 +37,26 @@ import '@daxiangme/form-vue/style.css'
30
37
 
31
38
  ## 注册组件
32
39
 
40
+ 库构建会为模板用到的 Element Plus 控件注入对应 `style/css` 副作用导入。按需宿主直接导入两个公共组件即可:
41
+
42
+ ```ts
43
+ import { createApp } from 'vue'
44
+ import { FormDesigner, FormRenderer } from '@daxiangme/form-vue'
45
+
46
+ import App from './App.vue'
47
+
48
+ createApp(App).mount('#app')
49
+ ```
50
+
51
+ 已经全量 `app.use(ElementPlus)` 的工程仍然兼容。可选插件 `DaxiangFormVue` 只把 `FormDesigner` / `FormRenderer` 注册为全局组件,不负责安装 Element Plus:
52
+
33
53
  ```ts
34
54
  import { createApp } from 'vue'
35
- import ElementPlus from 'element-plus'
36
55
  import { DaxiangFormVue } from '@daxiangme/form-vue'
37
56
 
38
57
  import App from './App.vue'
39
58
 
40
- createApp(App).use(ElementPlus).use(DaxiangFormVue).mount('#app')
59
+ createApp(App).use(DaxiangFormVue).mount('#app')
41
60
  ```
42
61
 
43
62
  ## 设计表单