vue2-components-plus 1.0.15 → 1.0.17
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 +23 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,17 +50,17 @@ pnpm i vue2-components-plus element-ui
|
|
|
50
50
|
Vue.use(ElementUI)
|
|
51
51
|
// 安装组件库(ts需要//@ts-ignore)
|
|
52
52
|
//@ts-ignore
|
|
53
|
-
import NsComponents from 'vue2-components-plus'
|
|
53
|
+
import NsComponents from 'vue2-components-plus/legacy'
|
|
54
54
|
import 'vue2-components-plus/dist/vue2-components-plus.css'
|
|
55
55
|
|
|
56
|
-
// Vuex
|
|
56
|
+
// 状态管理:Vuex
|
|
57
57
|
import store from './store'
|
|
58
|
-
Vue.use(NsComponents, { store })
|
|
58
|
+
Vue.use(NsComponents.default || NsComponents, { store })
|
|
59
59
|
|
|
60
|
-
// Pinia
|
|
60
|
+
// 状态管理:Pinia
|
|
61
61
|
import { createPinia } from 'pinia'
|
|
62
62
|
const pinia = createPinia()
|
|
63
|
-
Vue.use(NsComponents, { pinia })
|
|
63
|
+
Vue.use(NsComponents.default || NsComponents, { pinia })
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
## 📋 组件列表
|
|
@@ -174,9 +174,24 @@ closeAllNsDialog()
|
|
|
174
174
|
```
|
|
175
175
|
|
|
176
176
|
### Legacy / ES5 兼容构建
|
|
177
|
-
-
|
|
178
|
-
-
|
|
179
|
-
-
|
|
177
|
+
- **产物与入口**:ES5 产物在 `dist/vue2-components-plus.es5.js`,入口别名 `vue2-components-plus/legacy`(根目录有 `legacy.js` 指向 ES5)。
|
|
178
|
+
- **生成(维护者)**:`pnpm build:es5`(会先跑默认 `pnpm build`,再用 Babel 输出 ES5 文件)。
|
|
179
|
+
- **在老版 webpack + Vue2 项目中使用**:
|
|
180
|
+
```js
|
|
181
|
+
import Vue from 'vue'
|
|
182
|
+
import LegacyLib from 'vue2-components-plus/legacy'
|
|
183
|
+
import 'vue2-components-plus/dist/vue2-components-plus.css'
|
|
184
|
+
Vue.use(LegacyLib.default || LegacyLib)
|
|
185
|
+
```
|
|
186
|
+
- **无打包器 / 直接 `<script>` 引入**(先把 dist 文件放到静态目录):
|
|
187
|
+
```html
|
|
188
|
+
<link rel="stylesheet" href="/lib/vue2-components-plus.css" />
|
|
189
|
+
<script src="/lib/vue2-components-plus.es5.js"></script>
|
|
190
|
+
<script>
|
|
191
|
+
Vue.use(Vue2ComponentsPlus.default || Vue2ComponentsPlus)
|
|
192
|
+
</script>
|
|
193
|
+
```
|
|
194
|
+
- **若仍有语法报错**:在宿主项目对 `node_modules/vue2-components-plus` 追加 `babel-loader` 规则(targets IE11)。
|
|
180
195
|
|
|
181
196
|
## 🔧 自定义指令
|
|
182
197
|
|