view-ui-plus-derive 0.2.0 → 0.2.1

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
@@ -13,8 +13,6 @@ or
13
13
  yarn add view-ui-plus-derive
14
14
  ```
15
15
 
16
- [TOC]
17
-
18
16
  ### CDN引入
19
17
 
20
18
  ```html
@@ -99,7 +97,7 @@ createApp(App).use(ViewUIPlus).component(Combi.name, Combi).mount('#app')
99
97
  仅部分组件需要对应样式,如图
100
98
  ![css](./assets/import%20component%20css.png)
101
99
 
102
- ### 国际化
100
+ ## 国际化
103
101
 
104
102
  目前提供中英翻译,默认显示简体中文。在安装插件时可传入需要显示的语言,若使用vue-i18n,则只需传入vue-i18n实例
105
103
 
@@ -228,7 +226,7 @@ createApp(App)
228
226
  .mount('#app')
229
227
  ```
230
228
 
231
- ### 调优
229
+ ## 调优
232
230
 
233
231
  - 为多选模式的iview Select添加全选功能。**若全局安装了插件则无需再次注册指令**
234
232
 
@@ -251,26 +249,59 @@ import { iviewSelect as vIviewSelect } from "view-ui-plus-derive";
251
249
  <Select v-iview-select:all="true" multiple></Select>
252
250
  ```
253
251
 
254
- - 调整iview的InputNumber默认值为null,避免在值为undefined时显示 1
255
- - 为InputNumber添加propunset,用于设置在清空时的默认值
252
+ - 调整iview的 InputNumber 默认值为null,避免在值为undefined时显示 1
253
+ - 为 InputNumber 添加prop:`unset`,用于设置在清空时的默认值
256
254
 
257
255
  ```js
258
256
  import 'view-ui-plus-derive/iview-mods/input-number'
259
257
  ```
260
258
 
261
- - 修复iview Select启用filterable时在过滤后可能只显示之前所选项的bug
259
+ - 修复 iview Select 启用filterable时在过滤后可能只显示之前所选项的bug
262
260
 
263
261
  ```js
264
262
  import 'view-ui-plus-derive/iview-mods/select'
265
263
  ```
266
264
 
267
- - 修复Table在某些情况下表头/固定列与内容错位
265
+ - 修复 Table 在某些情况下表头/固定列与内容错位
268
266
 
269
267
  ```js
270
268
  import 'view-ui-plus-derive/iview-mods/table'
271
269
  ```
272
270
 
273
- 也可以一次性引入iview-mods下的input-number、select、table
271
+ - 为 Table 添加prop:`cache-cols`,启用列宽缓存功能
272
+
273
+ ```js
274
+ import 'view-ui-plus-derive/iview-mods/table-cache-cols'
275
+ ```
276
+
277
+ ```vue
278
+ <template>
279
+ <Table border :columns="columns" :cache-cols="cacheCols"></Table>
280
+ </template>
281
+
282
+ <script setup>
283
+ const columns = [
284
+ {
285
+ prop: 'name',
286
+ label: '名称',
287
+ resizable: true
288
+ },
289
+ {
290
+ prop: 'age',
291
+ label: '年龄'
292
+ }
293
+ ]
294
+ // keys 决定存储路径,cols 为列配置
295
+ const cacheCols = {
296
+ // 若路径较深,建议适当扁平以简化存取的对象结构
297
+ // 如下会以 app.userA['page.list.cols'] 的形式读写 localStorage。若去掉中括号,对象将为 app.userA.page.list.cols 的形式
298
+ keys: 'app.userA.[page.list.cols]', // 或者不使用点,如 'app.userA.page_list_cols' | 'app.userA.page-list-cols'
299
+ cols: columns
300
+ }
301
+ </script>
302
+ ```
303
+
304
+ 也可以一次性引入iview-mods下的所有mod:input-number、select、table、cache-cols等
274
305
 
275
306
  ```js
276
307
  // 本地引入
@@ -298,7 +329,7 @@ import 'view-ui-plus-derive/iview-mod.css'
298
329
  <link rel="stylesheet" href="https://unpkg.com/view-ui-plus-derive/dist/iview-mod.css" />
299
330
  ```
300
331
 
301
- ### 组件
332
+ ## 组件
302
333
 
303
334
  [AllCheckbox](./md/AllCheckbox.md)
304
335
  提供全选功能的CheckboxGroup
@@ -307,13 +338,13 @@ import 'view-ui-plus-derive/iview-mod.css'
307
338
  更易于使用的Switch
308
339
 
309
340
  [RemoteSelect](./md/RemoteSelect.md)
310
- 远程Select
341
+ 获取远程数据的Select,默认在展开时才触发请求
311
342
 
312
343
  [CacheSelect](./md/CacheSelect.md)
313
344
  避免重复调用远程接口的RemoteSelect,同一个cacheId对应只触发一次请求
314
345
 
315
346
  [Combi](./md/Combi.md)
316
- 类似iview Input[append prepend]的组合框
347
+ 类似iview Input[append prepend]样式的组合框
317
348
 
318
349
  [CountRange](./md/CountRange.md)
319
350
  数值范围组件