@netang/quasar 0.0.106 → 0.1.8
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/_docs/docs/components/field-table.md +30 -29
- package/_docs/docs/components/table.md +24 -25
- package/_docs/docs/utils/table.md +195 -194
- package/components/field-table/index.vue +1227 -1222
- package/components/render/index.vue +120 -150
- package/components/table/index.vue +471 -456
- package/package.json +1 -1
- package/utils/$power.js +1216 -1215
- package/utils/$render.js +75 -0
- package/utils/$table.js +1001 -999
- package/utils/index.js +62 -61
- package/utils/timestamp.js +18 -18
package/utils/$render.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { provide } from 'vue'
|
|
2
|
+
|
|
3
|
+
import $n_router from '@netang/utils/vue/router'
|
|
4
|
+
|
|
5
|
+
import $n_isValidString from '@netang/utils/isValidString'
|
|
6
|
+
import $n_isValidObject from '@netang/utils/isValidObject'
|
|
7
|
+
|
|
8
|
+
import { NRenderKey } from './symbols'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 创建渲染
|
|
12
|
+
*/
|
|
13
|
+
function create(options) {
|
|
14
|
+
|
|
15
|
+
// ==========【数据】=================================================================================================
|
|
16
|
+
|
|
17
|
+
// 获取参数
|
|
18
|
+
const o = Object.assign({
|
|
19
|
+
// 组件标识
|
|
20
|
+
name: '',
|
|
21
|
+
// 路由路径
|
|
22
|
+
path: '',
|
|
23
|
+
// 路由参数
|
|
24
|
+
query: {},
|
|
25
|
+
// 组件传参
|
|
26
|
+
props: {},
|
|
27
|
+
}, options)
|
|
28
|
+
|
|
29
|
+
const data = {
|
|
30
|
+
// 组件标识
|
|
31
|
+
name: o.name,
|
|
32
|
+
// 参数
|
|
33
|
+
query: $n_isValidObject(o.query) ? o.query : {},
|
|
34
|
+
// 组件传参
|
|
35
|
+
props: o.props,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 如果有路由路径
|
|
39
|
+
if ($n_isValidString(o.path)) {
|
|
40
|
+
|
|
41
|
+
// 获取页面路由
|
|
42
|
+
const $route = $n_router.resolve({
|
|
43
|
+
path: o.path,
|
|
44
|
+
query: data.query,
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
Object.assign(data, {
|
|
48
|
+
// 当前路由全路径
|
|
49
|
+
routeFullPath: $route.fullPath,
|
|
50
|
+
// 当前路由路径
|
|
51
|
+
routePath: $route.path,
|
|
52
|
+
// 当前路由参数
|
|
53
|
+
routeQuery: $route.query,
|
|
54
|
+
// 获取当前路由,
|
|
55
|
+
getRoute() {
|
|
56
|
+
return $route
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// 提供可以被后代组件注入的值
|
|
62
|
+
provide(NRenderKey, data)
|
|
63
|
+
|
|
64
|
+
return data
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 业务渲染
|
|
69
|
+
*/
|
|
70
|
+
const $render = {
|
|
71
|
+
// 创建表格
|
|
72
|
+
create,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default $render
|