vue2-client 1.6.49 → 1.7.0

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.
Files changed (119) hide show
  1. package/.env +15 -15
  2. package/CHANGELOG.md +628 -625
  3. package/index.js +30 -30
  4. package/package.json +81 -81
  5. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
  6. package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
  7. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +667 -667
  8. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +733 -733
  9. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +468 -462
  10. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +508 -508
  11. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +146 -140
  12. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  13. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  14. package/src/base-client/components/common/Upload/Upload.vue +168 -168
  15. package/src/base-client/components/common/XAddForm/XAddForm.vue +325 -325
  16. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +279 -279
  17. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  18. package/src/base-client/components/common/XForm/XForm.vue +180 -180
  19. package/src/base-client/components/common/XForm/XFormItem.vue +513 -513
  20. package/src/base-client/components/common/XForm/XTreeSelect.vue +184 -184
  21. package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
  22. package/src/base-client/components/common/XFormTable/XFormTable.vue +344 -336
  23. package/src/base-client/components/common/XFormTable/index.md +97 -97
  24. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +132 -132
  25. package/src/base-client/components/common/XTable/XTable.vue +506 -506
  26. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +111 -111
  27. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +231 -231
  28. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  29. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  30. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  31. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  32. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  33. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  34. package/src/base-client/plugins/AppData.js +76 -76
  35. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  36. package/src/base-client/plugins/PagedList.js +177 -177
  37. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  38. package/src/base-client/plugins/i18n-extend.js +32 -32
  39. package/src/components/Ellipsis/Ellipsis.vue +65 -65
  40. package/src/components/Ellipsis/index.md +38 -38
  41. package/src/components/NumberInfo/index.md +43 -43
  42. package/src/components/STable/README.md +341 -341
  43. package/src/components/STable/index.js +318 -318
  44. package/src/components/Trend/index.md +45 -45
  45. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  46. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  47. package/src/components/exception/ExceptionPage.vue +70 -70
  48. package/src/components/form/FormRow.vue +52 -52
  49. package/src/components/index.js +36 -36
  50. package/src/components/menu/SideMenu.vue +62 -62
  51. package/src/components/menu/menu.js +273 -273
  52. package/src/components/page/header/index.less +40 -40
  53. package/src/components/setting/Setting.vue +235 -235
  54. package/src/components/table/StandardTable.vue +141 -141
  55. package/src/components/table/advance/ActionColumns.vue +158 -158
  56. package/src/components/table/advance/SearchArea.vue +355 -355
  57. package/src/components/tool/AStepItem.vue +60 -60
  58. package/src/components/tool/AvatarList.vue +68 -68
  59. package/src/components/tool/Drawer.vue +142 -142
  60. package/src/components/tool/TagSelect.vue +83 -83
  61. package/src/components/transition/PageToggleTransition.vue +97 -97
  62. package/src/config/CreateQueryConfig.js +307 -307
  63. package/src/config/default/admin.config.js +18 -18
  64. package/src/config/replacer/resolve.config.js +67 -67
  65. package/src/layouts/CommonLayout.vue +42 -42
  66. package/src/layouts/ComponentLayoutOne.vue +47 -47
  67. package/src/layouts/PageLayout.vue +151 -151
  68. package/src/layouts/SinglePageView.vue +116 -116
  69. package/src/layouts/footer/PageFooter.vue +49 -49
  70. package/src/layouts/header/AdminHeader.vue +134 -134
  71. package/src/layouts/header/HeaderAvatar.vue +64 -64
  72. package/src/layouts/header/HeaderNotice.vue +176 -176
  73. package/src/layouts/header/HeaderSearch.vue +67 -67
  74. package/src/layouts/header/InstitutionDetail.vue +181 -181
  75. package/src/layouts/header/index.less +92 -92
  76. package/src/layouts/tabs/TabsHead.vue +190 -190
  77. package/src/layouts/tabs/TabsView.vue +379 -379
  78. package/src/mock/goods/index.js +108 -108
  79. package/src/pages/CreateQueryPage.vue +84 -84
  80. package/src/pages/login/Login.vue +369 -369
  81. package/src/pages/report/ReportTable.js +124 -124
  82. package/src/pages/report/ReportTableHome.vue +28 -28
  83. package/src/pages/resourceManage/orgListManage.vue +98 -98
  84. package/src/pages/system/dictionary/index.vue +43 -43
  85. package/src/pages/system/file/index.vue +317 -317
  86. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  87. package/src/pages/system/monitor/operLog/index.vue +36 -36
  88. package/src/pages/system/settings/index.vue +126 -126
  89. package/src/pages/system/settings/modifyPassword.vue +109 -109
  90. package/src/router/async/config.async.js +28 -28
  91. package/src/router/async/router.map.js +66 -68
  92. package/src/router/index.js +27 -27
  93. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  94. package/src/services/api/LogDetailsViewApi.js +10 -10
  95. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  96. package/src/services/api/TicketDetailsViewApi.js +34 -34
  97. package/src/services/api/cas.js +79 -79
  98. package/src/services/api/common.js +137 -132
  99. package/src/services/api/commonTempTable.js +10 -10
  100. package/src/services/api/index.js +17 -17
  101. package/src/services/api/logininfor/index.js +6 -6
  102. package/src/services/api/manage.js +8 -8
  103. package/src/services/apiService.js +14 -14
  104. package/src/services/user.js +67 -67
  105. package/src/store/modules/index.js +4 -4
  106. package/src/theme/default/nprogress.less +76 -76
  107. package/src/theme/default/style.less +58 -58
  108. package/src/utils/EncryptUtil.js +53 -53
  109. package/src/utils/colors.js +107 -107
  110. package/src/utils/excel/Blob.js +180 -180
  111. package/src/utils/excel/Export2Excel.js +141 -141
  112. package/src/utils/formatter.js +68 -68
  113. package/src/utils/i18n.js +80 -80
  114. package/src/utils/map-utils.js +37 -37
  115. package/src/utils/theme-color-replacer-extend.js +91 -91
  116. package/src/utils/themeUtil.js +100 -100
  117. package/src/utils/util.js +230 -230
  118. package/vue.config.js +106 -106
  119. package/src/pages/system/queryParams/index.vue +0 -43
@@ -1,177 +1,177 @@
1
- import Vue from 'vue'
2
- import { nanoid } from 'nanoid'
3
-
4
- export default class PagedList {
5
- // 用url及pageSize构造
6
- // url - 加载数据的url
7
- // pageSize - 每页数据个数
8
- // params - 除正常查询条件外,附加到后台sql中的参数,可以为空。格式为:{参数名:参数值}
9
- // sums - 需要求和的字段。格式为:{参数名:参数值}
10
- // isBlank - 是否使用空行填充表格,值为true或者 false
11
- // comp - 调用时的组件名,方便调试
12
- // aoteEncrypt - 加密类型, 不传使用全局的
13
- // encryKey - 加密key, 不传使用全局的
14
- // timeout - 查询超时时间, 默认50秒
15
- constructor (url, pageSize, params, sums, isBlank, comp, aoteEncrypt, encryKey, timeout) {
16
- // 正在查询标志位
17
- this.seaching = false
18
- this.url = url
19
- this.pageSize = pageSize
20
- this.pageIndex = 0
21
- this.isBlank = isBlank
22
- this.aoteEncrypt = aoteEncrypt || Vue.mmType
23
- this.encryKey = encryKey || Vue.mm
24
- this.timeout = timeout || 50000
25
-
26
- // 登记组件名
27
- if (comp) {
28
- this.comp = comp
29
- }
30
-
31
- // 登记参数源码,查询前,执行参数源码,获得实际参数值
32
- if (params) {
33
- this.paramSource = params
34
- }
35
- // 查询时,提交后台的参数值
36
- this.params = {}
37
-
38
- // 求和的字段
39
- this.sums = sums
40
- // 符合条件的数据总数
41
- this.count = 0
42
- // 符合条件的数据总页数
43
- this.totalPage = 0
44
- // 加载过来的数据
45
- this.rows = []
46
- // 状态,字符串型,包括:初始(默认),查询,错误,正确
47
- this.state = '初始'
48
- // 出现错误时的错误内容,没找到符合条件的数据当错误处理
49
- this.error = '请输入条件, 进行查询'
50
-
51
- // 每次加载所需要的条件
52
- this.condition = null
53
- this.model = null
54
- this.condValue = null
55
-
56
- // 初始填充数据空行
57
- // isNuN标记本行是否为空行
58
- if (isBlank === true) {
59
- for (let i = 1; i <= pageSize; i++) {
60
- this.rows.push({ isNuN: 'true' })
61
- }
62
- }
63
- }
64
-
65
- // 执行查询过程,加载数据汇总信息
66
- // condition - 查询组件产生的查询条件
67
- // model - 查询组件收集到的输入数据
68
- // condValue - 交给后台的查询条件,可以为空
69
- search (condition, model, condValue) {
70
- let param
71
- // 保存条件,以便加载某页时可以直接调用
72
- this.condition = condition
73
- this.model = model
74
- this.condValue = condValue
75
- this.state = '查询'
76
- this.procParams()
77
- this.seaching = true
78
- if (this.sums) {
79
- const totals = []
80
- for (const key in this.sums) {
81
- totals.push(key)
82
- param = { data: this.params, sums: totals }
83
- }
84
- } else {
85
- param = { data: this.params }
86
- }
87
- // 发生请求时,不进行任何提醒
88
- return Vue.resetpost(`${this.url}/n`, param, {
89
- timeout: this.timeout,
90
- rejectMsg: null,
91
- aoteEncrypt: this.aoteEncrypt,
92
- encryKey: this.encryKey
93
- }).then(response => {
94
- this.seaching = false
95
- if (response.n === 0) {
96
- this.state = '错误'
97
- this.error = '没有符合条件的记录'
98
- this.rows = []
99
- return
100
- }
101
- this.state = '正确'
102
- this.count = response.n
103
- for (const key in this.sums) {
104
- this.sums[key] = response[key]
105
- }
106
- this.totalPage = Math.ceil(this.count / this.pageSize)
107
- // 加载第一页数据
108
- return this.loadPage(1, this.pageSize)
109
- }).catch((error) => {
110
- this.seaching = false
111
- if (error.status !== 603) {
112
- this.state = '错误'
113
- this.error = `提取数据出错,错误码: ${error.status}, 错误信息:${error.data},组件:${this.comp}`
114
- }
115
- })
116
- }
117
-
118
- // 重新进行查询
119
- refresh () {
120
- this.search(this.condition, this.model, this.condValue)
121
- }
122
-
123
- // 加载一页数据
124
- loadPage (pageNo, pageSize) {
125
- this.pageIndex = pageNo
126
- this.pageSize = pageSize
127
- this.state = '查询'
128
- return this.postGen(pageNo, pageSize)
129
- }
130
-
131
- postGen (pageNo, pageSize) {
132
- this.seaching = true
133
- return Vue.resetpost(`${this.url}?pageNo=${pageNo}&pageSize=${pageSize}`, { data: this.params }, {
134
- aoteEncrypt: this.aoteEncrypt,
135
- encryKey: this.encryKey,
136
- resolveMsg: null,
137
- rejectMsg: null
138
- }).then(response => {
139
- this.state = '正确'
140
- // a-table需要每条数据都加上一个字符传类型的key 这里通过一个生成uuid的库加入
141
- this.rows = response.map(item => {
142
- item.nanoid = nanoid()
143
- return item
144
- })
145
- if (this.isBlank === true) {
146
- const size = response.length % this.pageSize
147
- if (pageNo === this.totalPage) {
148
- for (let i = 1; i <= this.pageSize - size; i++) {
149
- this.rows.push({ isNuN: 'true' })
150
- }
151
- }
152
- }
153
- this.pageIndex = pageNo
154
- this.seaching = false
155
- }).catch(error => {
156
- this.seaching = false
157
- this.state = '错误'
158
- this.error = JSON.stringify(error)
159
- throw error
160
- })
161
- }
162
-
163
- // 处理查询参数,把condition以及condValue附加到参数列表中,condValue指后台查询条件
164
- procParams () {
165
- this.params.condition = this.condition
166
- if (this.condValue) {
167
- this.params.condValue = this.condValue
168
- }
169
- if (!this.paramSource) {
170
- return
171
- }
172
- // 对附加参数进行计算
173
- for (const name in this.paramSource) {
174
- this.params[name] = this.paramSource[name]
175
- }
176
- }
177
- }
1
+ import Vue from 'vue'
2
+ import { nanoid } from 'nanoid'
3
+
4
+ export default class PagedList {
5
+ // 用url及pageSize构造
6
+ // url - 加载数据的url
7
+ // pageSize - 每页数据个数
8
+ // params - 除正常查询条件外,附加到后台sql中的参数,可以为空。格式为:{参数名:参数值}
9
+ // sums - 需要求和的字段。格式为:{参数名:参数值}
10
+ // isBlank - 是否使用空行填充表格,值为true或者 false
11
+ // comp - 调用时的组件名,方便调试
12
+ // aoteEncrypt - 加密类型, 不传使用全局的
13
+ // encryKey - 加密key, 不传使用全局的
14
+ // timeout - 查询超时时间, 默认50秒
15
+ constructor (url, pageSize, params, sums, isBlank, comp, aoteEncrypt, encryKey, timeout) {
16
+ // 正在查询标志位
17
+ this.seaching = false
18
+ this.url = url
19
+ this.pageSize = pageSize
20
+ this.pageIndex = 0
21
+ this.isBlank = isBlank
22
+ this.aoteEncrypt = aoteEncrypt || Vue.mmType
23
+ this.encryKey = encryKey || Vue.mm
24
+ this.timeout = timeout || 50000
25
+
26
+ // 登记组件名
27
+ if (comp) {
28
+ this.comp = comp
29
+ }
30
+
31
+ // 登记参数源码,查询前,执行参数源码,获得实际参数值
32
+ if (params) {
33
+ this.paramSource = params
34
+ }
35
+ // 查询时,提交后台的参数值
36
+ this.params = {}
37
+
38
+ // 求和的字段
39
+ this.sums = sums
40
+ // 符合条件的数据总数
41
+ this.count = 0
42
+ // 符合条件的数据总页数
43
+ this.totalPage = 0
44
+ // 加载过来的数据
45
+ this.rows = []
46
+ // 状态,字符串型,包括:初始(默认),查询,错误,正确
47
+ this.state = '初始'
48
+ // 出现错误时的错误内容,没找到符合条件的数据当错误处理
49
+ this.error = '请输入条件, 进行查询'
50
+
51
+ // 每次加载所需要的条件
52
+ this.condition = null
53
+ this.model = null
54
+ this.condValue = null
55
+
56
+ // 初始填充数据空行
57
+ // isNuN标记本行是否为空行
58
+ if (isBlank === true) {
59
+ for (let i = 1; i <= pageSize; i++) {
60
+ this.rows.push({ isNuN: 'true' })
61
+ }
62
+ }
63
+ }
64
+
65
+ // 执行查询过程,加载数据汇总信息
66
+ // condition - 查询组件产生的查询条件
67
+ // model - 查询组件收集到的输入数据
68
+ // condValue - 交给后台的查询条件,可以为空
69
+ search (condition, model, condValue) {
70
+ let param
71
+ // 保存条件,以便加载某页时可以直接调用
72
+ this.condition = condition
73
+ this.model = model
74
+ this.condValue = condValue
75
+ this.state = '查询'
76
+ this.procParams()
77
+ this.seaching = true
78
+ if (this.sums) {
79
+ const totals = []
80
+ for (const key in this.sums) {
81
+ totals.push(key)
82
+ param = { data: this.params, sums: totals }
83
+ }
84
+ } else {
85
+ param = { data: this.params }
86
+ }
87
+ // 发生请求时,不进行任何提醒
88
+ return Vue.resetpost(`${this.url}/n`, param, {
89
+ timeout: this.timeout,
90
+ rejectMsg: null,
91
+ aoteEncrypt: this.aoteEncrypt,
92
+ encryKey: this.encryKey
93
+ }).then(response => {
94
+ this.seaching = false
95
+ if (response.n === 0) {
96
+ this.state = '错误'
97
+ this.error = '没有符合条件的记录'
98
+ this.rows = []
99
+ return
100
+ }
101
+ this.state = '正确'
102
+ this.count = response.n
103
+ for (const key in this.sums) {
104
+ this.sums[key] = response[key]
105
+ }
106
+ this.totalPage = Math.ceil(this.count / this.pageSize)
107
+ // 加载第一页数据
108
+ return this.loadPage(1, this.pageSize)
109
+ }).catch((error) => {
110
+ this.seaching = false
111
+ if (error.status !== 603) {
112
+ this.state = '错误'
113
+ this.error = `提取数据出错,错误码: ${error.status}, 错误信息:${error.data},组件:${this.comp}`
114
+ }
115
+ })
116
+ }
117
+
118
+ // 重新进行查询
119
+ refresh () {
120
+ this.search(this.condition, this.model, this.condValue)
121
+ }
122
+
123
+ // 加载一页数据
124
+ loadPage (pageNo, pageSize) {
125
+ this.pageIndex = pageNo
126
+ this.pageSize = pageSize
127
+ this.state = '查询'
128
+ return this.postGen(pageNo, pageSize)
129
+ }
130
+
131
+ postGen (pageNo, pageSize) {
132
+ this.seaching = true
133
+ return Vue.resetpost(`${this.url}?pageNo=${pageNo}&pageSize=${pageSize}`, { data: this.params }, {
134
+ aoteEncrypt: this.aoteEncrypt,
135
+ encryKey: this.encryKey,
136
+ resolveMsg: null,
137
+ rejectMsg: null
138
+ }).then(response => {
139
+ this.state = '正确'
140
+ // a-table需要每条数据都加上一个字符传类型的key 这里通过一个生成uuid的库加入
141
+ this.rows = response.map(item => {
142
+ item.nanoid = nanoid()
143
+ return item
144
+ })
145
+ if (this.isBlank === true) {
146
+ const size = response.length % this.pageSize
147
+ if (pageNo === this.totalPage) {
148
+ for (let i = 1; i <= this.pageSize - size; i++) {
149
+ this.rows.push({ isNuN: 'true' })
150
+ }
151
+ }
152
+ }
153
+ this.pageIndex = pageNo
154
+ this.seaching = false
155
+ }).catch(error => {
156
+ this.seaching = false
157
+ this.state = '错误'
158
+ this.error = JSON.stringify(error)
159
+ throw error
160
+ })
161
+ }
162
+
163
+ // 处理查询参数,把condition以及condValue附加到参数列表中,condValue指后台查询条件
164
+ procParams () {
165
+ this.params.condition = this.condition
166
+ if (this.condValue) {
167
+ this.params.condValue = this.condValue
168
+ }
169
+ if (!this.paramSource) {
170
+ return
171
+ }
172
+ // 对附加参数进行计算
173
+ for (const name in this.paramSource) {
174
+ this.params[name] = this.paramSource[name]
175
+ }
176
+ }
177
+ }
@@ -1,20 +1,20 @@
1
- import { get } from '@vue2-client/services/api'
2
- import Vue from 'vue'
3
-
4
- async function loginStart (name, password) {
5
- const resource = await get(`/rs/user/${name}/${password}/智慧OA`, {})
6
- console.log('登陆获取', resource)
7
- Vue.$login.f = resource
8
- await Promise.all([Vue.$appdata.load()])
9
- const login = {
10
- f: Vue.$login.f,
11
- jwt: Vue.$login.f.id,
12
- r: Vue.$login.r
13
- }
14
- Vue.$store.commit('account/setLogin', login)
15
- return resource
16
- }
17
-
18
- export {
19
- loginStart
20
- }
1
+ import { get } from '@vue2-client/services/api'
2
+ import Vue from 'vue'
3
+
4
+ async function loginStart (name, password) {
5
+ const resource = await get(`/rs/user/${name}/${password}/智慧OA`, {})
6
+ console.log('登陆获取', resource)
7
+ Vue.$login.f = resource
8
+ await Promise.all([Vue.$appdata.load()])
9
+ const login = {
10
+ f: Vue.$login.f,
11
+ jwt: Vue.$login.f.id,
12
+ r: Vue.$login.r
13
+ }
14
+ Vue.$store.commit('account/setLogin', login)
15
+ return resource
16
+ }
17
+
18
+ export {
19
+ loginStart
20
+ }
@@ -1,32 +1,32 @@
1
- // 语句模式
2
- const MODE = {
3
- STATEMENTS: 's', // 语句模式
4
- PHRASAL: 'p' // 词组模式
5
- }
6
-
7
- const VueI18nPlugin = {
8
- install: function (Vue) {
9
- Vue.mixin({
10
- methods: {
11
- $ta (syntaxKey, mode) {
12
- const _mode = mode || MODE.STATEMENTS
13
- const keys = syntaxKey.split('|')
14
- const _this = this
15
- const locale = this.$i18n.locale
16
- let message = ''
17
- const splitter = locale === 'US' ? ' ' : ''
18
- // 拼接 message
19
- keys.forEach(key => {
20
- message += _this.$t(key) + splitter
21
- })
22
- // 英文环境语句模式下,转换单词大小写
23
- if (keys.length > 0 && _mode === MODE.STATEMENTS && locale === 'US') {
24
- message = message.charAt(0).toUpperCase() + message.toLowerCase().substring(1)
25
- }
26
- return message
27
- }
28
- }
29
- })
30
- }
31
- }
32
- export default VueI18nPlugin
1
+ // 语句模式
2
+ const MODE = {
3
+ STATEMENTS: 's', // 语句模式
4
+ PHRASAL: 'p' // 词组模式
5
+ }
6
+
7
+ const VueI18nPlugin = {
8
+ install: function (Vue) {
9
+ Vue.mixin({
10
+ methods: {
11
+ $ta (syntaxKey, mode) {
12
+ const _mode = mode || MODE.STATEMENTS
13
+ const keys = syntaxKey.split('|')
14
+ const _this = this
15
+ const locale = this.$i18n.locale
16
+ let message = ''
17
+ const splitter = locale === 'US' ? ' ' : ''
18
+ // 拼接 message
19
+ keys.forEach(key => {
20
+ message += _this.$t(key) + splitter
21
+ })
22
+ // 英文环境语句模式下,转换单词大小写
23
+ if (keys.length > 0 && _mode === MODE.STATEMENTS && locale === 'US') {
24
+ message = message.charAt(0).toUpperCase() + message.toLowerCase().substring(1)
25
+ }
26
+ return message
27
+ }
28
+ }
29
+ })
30
+ }
31
+ }
32
+ export default VueI18nPlugin
@@ -1,65 +1,65 @@
1
- <script>
2
- import Tooltip from 'ant-design-vue/es/tooltip'
3
- import { cutStrByFullLength, getStrFullLength } from '@vue2-client/components/_util/util'
4
- /*
5
- const isSupportLineClamp = document.body.style.webkitLineClamp !== undefined;
6
-
7
- const TooltipOverlayStyle = {
8
- overflowWrap: 'break-word',
9
- wordWrap: 'break-word',
10
- };
11
- */
12
-
13
- export default {
14
- name: 'Ellipsis',
15
- components: {
16
- Tooltip
17
- },
18
- props: {
19
- prefixCls: {
20
- type: String,
21
- default: 'ant-pro-ellipsis'
22
- },
23
- tooltip: {
24
- type: Boolean,
25
- default: false
26
- },
27
- length: {
28
- type: [String, Number],
29
- required: true
30
- },
31
- lines: {
32
- type: Number,
33
- default: 1
34
- },
35
- fullWidthRecognition: {
36
- type: Boolean,
37
- default: false
38
- }
39
- },
40
- methods: {
41
- getStrDom (str, fullLength) {
42
- return (
43
- <span>{ cutStrByFullLength(str, this.length) + (fullLength > this.length ? '...' : '') }</span>
44
- )
45
- },
46
- getTooltip (fullStr, fullLength) {
47
- return (
48
- <Tooltip>
49
- <template slot="title">{ fullStr }</template>
50
- { this.getStrDom(fullStr, fullLength) }
51
- </Tooltip>
52
- )
53
- }
54
- },
55
- render () {
56
- const { tooltip, length } = this.$props
57
- const str = this.$slots.default.map(vNode => vNode.text).join('')
58
- const fullLength = getStrFullLength(str)
59
- const strDom = tooltip && fullLength > length ? this.getTooltip(str, fullLength) : this.getStrDom(str, fullLength)
60
- return (
61
- strDom
62
- )
63
- }
64
- }
65
- </script>
1
+ <script>
2
+ import Tooltip from 'ant-design-vue/es/tooltip'
3
+ import { cutStrByFullLength, getStrFullLength } from '@vue2-client/components/_util/util'
4
+ /*
5
+ const isSupportLineClamp = document.body.style.webkitLineClamp !== undefined;
6
+
7
+ const TooltipOverlayStyle = {
8
+ overflowWrap: 'break-word',
9
+ wordWrap: 'break-word',
10
+ };
11
+ */
12
+
13
+ export default {
14
+ name: 'Ellipsis',
15
+ components: {
16
+ Tooltip
17
+ },
18
+ props: {
19
+ prefixCls: {
20
+ type: String,
21
+ default: 'ant-pro-ellipsis'
22
+ },
23
+ tooltip: {
24
+ type: Boolean,
25
+ default: false
26
+ },
27
+ length: {
28
+ type: [String, Number],
29
+ required: true
30
+ },
31
+ lines: {
32
+ type: Number,
33
+ default: 1
34
+ },
35
+ fullWidthRecognition: {
36
+ type: Boolean,
37
+ default: false
38
+ }
39
+ },
40
+ methods: {
41
+ getStrDom (str, fullLength) {
42
+ return (
43
+ <span>{ cutStrByFullLength(str, this.length) + (fullLength > this.length ? '...' : '') }</span>
44
+ )
45
+ },
46
+ getTooltip (fullStr, fullLength) {
47
+ return (
48
+ <Tooltip>
49
+ <template slot="title">{ fullStr }</template>
50
+ { this.getStrDom(fullStr, fullLength) }
51
+ </Tooltip>
52
+ )
53
+ }
54
+ },
55
+ render () {
56
+ const { tooltip, length } = this.$props
57
+ const str = this.$slots.default.map(vNode => vNode.text).join('')
58
+ const fullLength = getStrFullLength(str)
59
+ const strDom = tooltip && fullLength > length ? this.getTooltip(str, fullLength) : this.getStrDom(str, fullLength)
60
+ return (
61
+ strDom
62
+ )
63
+ }
64
+ }
65
+ </script>
@@ -1,38 +1,38 @@
1
- # Ellipsis 文本自动省略号
2
-
3
- 文本过长自动处理省略号,支持按照文本长度和最大行数两种方式截取。
4
-
5
-
6
-
7
- 引用方式:
8
-
9
- ```javascript
10
- import Ellipsis from '@vue2-client/components/Ellipsis'
11
-
12
- export default {
13
- components: {
14
- Ellipsis
15
- }
16
- }
17
- ```
18
-
19
-
20
-
21
- ## 代码演示 [demo](https://pro.loacg.com/test/home)
22
-
23
- ```html
24
- <ellipsis :length="100" tooltip>
25
- There were injuries alleged in three cases in 2015, and a
26
- fourth incident in September, according to the safety recall report. After meeting with US regulators in October, the firm decided to issue a voluntary recall.
27
- </ellipsis>
28
- ```
29
-
30
-
31
-
32
- ## API
33
-
34
-
35
- | 参数 | 说明 | 类型 | 默认值 |
36
- |---------|--------------------------|---------|-----|
37
- | tooltip | 移动到文本展示完整内容的提示 | boolean | - |
38
- | length | 在按照长度截取下的文本最大字符数,超过则截取省略 | number | - |
1
+ # Ellipsis 文本自动省略号
2
+
3
+ 文本过长自动处理省略号,支持按照文本长度和最大行数两种方式截取。
4
+
5
+
6
+
7
+ 引用方式:
8
+
9
+ ```javascript
10
+ import Ellipsis from '@vue2-client/components/Ellipsis'
11
+
12
+ export default {
13
+ components: {
14
+ Ellipsis
15
+ }
16
+ }
17
+ ```
18
+
19
+
20
+
21
+ ## 代码演示 [demo](https://pro.loacg.com/test/home)
22
+
23
+ ```html
24
+ <ellipsis :length="100" tooltip>
25
+ There were injuries alleged in three cases in 2015, and a
26
+ fourth incident in September, according to the safety recall report. After meeting with US regulators in October, the firm decided to issue a voluntary recall.
27
+ </ellipsis>
28
+ ```
29
+
30
+
31
+
32
+ ## API
33
+
34
+
35
+ | 参数 | 说明 | 类型 | 默认值 |
36
+ |---------|--------------------------|---------|-----|
37
+ | tooltip | 移动到文本展示完整内容的提示 | boolean | - |
38
+ | length | 在按照长度截取下的文本最大字符数,超过则截取省略 | number | - |