@netang/quasar 0.1.12 → 0.1.14

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.
@@ -61,8 +61,7 @@
61
61
 
62
62
  <slot
63
63
  name="after"
64
- :selected="tableSelected"
65
- :single-selected="currentSelectedItem"
64
+ :selected="currentSelectedItem"
66
65
  >
67
66
  <!-- 渲染 -->
68
67
  <n-render
@@ -1,110 +1,107 @@
1
- <template>
2
- <q-tr class="q-table__bottom">
3
- <q-td
4
- v-for="(item, index) in columns"
5
- :class="item.css"
6
- >
7
- <!-- 合计标题 -->
8
- <span v-if="index === 0">合计</span>
9
-
10
- <!-- 合计数据 -->
11
- <span v-else-if="item.value">{{item.value}}</span>
12
- </q-td>
13
- </q-tr>
14
- </template>
15
-
16
- <script>
17
- import { computed, inject } from 'vue'
18
-
19
- import $n_has from 'lodash/has'
20
- import $n_get from 'lodash/get'
21
-
22
- import $n_forEach from '@netang/utils/forEach'
23
-
24
- import $n_price from '../../utils/price'
25
-
26
- import { NTableKey } from '../../utils/symbols'
27
-
28
- export default {
29
-
30
- /**
31
- * 标识
32
- */
33
- name: 'NTableSummary',
34
-
35
- /**
36
- * 声明属性
37
- */
38
- props: {
39
- // 传值
40
- props: Object,
41
- // 选择类型, 可选值 single multiple none
42
- selection: String,
43
- // 表格合计数据
44
- data: Object,
45
- },
46
-
47
- /**
48
- * 组合式
49
- */
50
- setup(props) {
51
-
52
- // ==========【数据】============================================================================================
53
-
54
- // 获取表格注入
55
- const {
56
- // 表格选择类型
57
- tableSelection,
58
- } = inject(NTableKey)
59
-
60
- // ==========【计算属性】============================================================================================
61
-
62
- const columns = computed(function () {
63
-
64
- const lists = []
65
-
66
- if (tableSelection.value !== 'none') {
67
- lists.push({
68
- css: 'q-table--col-auto-width text-center',
69
- name: '',
70
- })
71
- }
72
-
73
- $n_forEach($n_get(props.props, 'cols'), function(item) {
74
-
75
- const {
76
- // 标识
77
- name,
78
- // 对齐方式
79
- align,
80
- } = item
81
-
82
- const res = {
83
- css: `text-${align}`,
84
- name,
85
- value: '',
86
- }
87
-
88
- // 如果有统计字段
89
- if ($n_has(props.data, name)) {
90
- // 判断是否是价格
91
- res.value = $n_has(item, 'price') ? $n_price(props.data[name]) : props.data[name]
92
- }
93
-
94
- lists.push(res)
95
- })
96
-
97
- return lists
98
- })
99
-
100
- // ==========【返回】=============================================================================================
101
-
102
- return {
103
- // 栏目
104
- columns,
105
- // 表格选择类型
106
- tableSelection,
107
- }
108
- },
109
- }
110
- </script>
1
+ <template>
2
+ <q-tr class="q-table__bottom">
3
+ <q-td
4
+ v-for="(item, index) in columns"
5
+ :class="item.css"
6
+ >
7
+ <!-- 合计标题 -->
8
+ <span v-if="index === 0">合计</span>
9
+
10
+ <!-- 合计数据 -->
11
+ <span v-else-if="item.value">{{item.value}}</span>
12
+ </q-td>
13
+ </q-tr>
14
+ </template>
15
+
16
+ <script>
17
+ import { computed, inject } from 'vue'
18
+
19
+ import $n_has from 'lodash/has'
20
+ import $n_get from 'lodash/get'
21
+
22
+ import $n_forEach from '@netang/utils/forEach'
23
+
24
+ import $n_price from '../../utils/price'
25
+
26
+ import { NTableKey } from '../../utils/symbols'
27
+
28
+ export default {
29
+
30
+ /**
31
+ * 标识
32
+ */
33
+ name: 'NTableSummary',
34
+
35
+ /**
36
+ * 声明属性
37
+ */
38
+ props: {
39
+ // 传值
40
+ props: Object,
41
+ },
42
+
43
+ /**
44
+ * 组合式
45
+ */
46
+ setup(props) {
47
+
48
+ // ==========【数据】============================================================================================
49
+
50
+ // 获取表格注入
51
+ const {
52
+ // 表格选择类型
53
+ tableSelection,
54
+ tableSummary,
55
+ } = inject(NTableKey)
56
+
57
+ // ==========【计算属性】============================================================================================
58
+
59
+ const columns = computed(function () {
60
+
61
+ const lists = []
62
+
63
+ if (tableSelection.value !== 'none') {
64
+ lists.push({
65
+ css: 'q-table--col-auto-width text-center',
66
+ name: '',
67
+ })
68
+ }
69
+
70
+ $n_forEach($n_get(props.props, 'cols'), function(item) {
71
+
72
+ const {
73
+ // 标识
74
+ name,
75
+ // 对齐方式
76
+ align,
77
+ } = item
78
+
79
+ const res = {
80
+ css: `text-${align}`,
81
+ name,
82
+ value: '',
83
+ }
84
+
85
+ // 如果有统计字段
86
+ if ($n_has(tableSummary.value, name)) {
87
+ // 判断是否是价格
88
+ res.value = $n_has(item, 'price') ? $n_price(tableSummary.value[name]) : tableSummary.value[name]
89
+ }
90
+
91
+ lists.push(res)
92
+ })
93
+
94
+ return lists
95
+ })
96
+
97
+ // ==========【返回】=============================================================================================
98
+
99
+ return {
100
+ // 栏目
101
+ columns,
102
+ // 表格选择类型
103
+ tableSelection,
104
+ }
105
+ },
106
+ }
107
+ </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netang/quasar",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "netang-quasar",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"