iov-pro-components 0.0.3

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 (133) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +192 -0
  3. package/.gitignore +3 -0
  4. package/README.md +4 -0
  5. package/babel.config.js +5 -0
  6. package/docs/.vuepress/config.js +169 -0
  7. package/docs/.vuepress/styles/index.styl +62 -0
  8. package/docs/.vuepress/styles/palette.styl +20 -0
  9. package/docs/.vuepress/theme/enhanceApp.js +100 -0
  10. package/docs/.vuepress/theme/index.js +3 -0
  11. package/docs/README.md +13 -0
  12. package/docs/components/description.md +519 -0
  13. package/docs/components/dialog-select.md +91 -0
  14. package/docs/components/display.md +36 -0
  15. package/docs/components/enums.md +33 -0
  16. package/docs/components/icon.md +406 -0
  17. package/docs/components/link-group.md +39 -0
  18. package/docs/components/page-detail.md +48 -0
  19. package/docs/components/page-module.md +51 -0
  20. package/docs/components/pro-form.md +958 -0
  21. package/docs/components/pro-table.md +683 -0
  22. package/docs/components/request.md +44 -0
  23. package/docs/components/search-table.md +963 -0
  24. package/docs/components/space.md +35 -0
  25. package/docs/components/sub-title.md +24 -0
  26. package/docs/components/submit-module.md +24 -0
  27. package/docs/template/add.md +124 -0
  28. package/docs/template/confirm.md +28 -0
  29. package/docs/template/detail.md +240 -0
  30. package/docs/template/dialog.md +339 -0
  31. package/docs/template/list.md +464 -0
  32. package/docs/template/tabs-mini.md +32 -0
  33. package/docs/template/tabs.md +32 -0
  34. package/jsconfig.json +19 -0
  35. package/lib/iov-pro-components.css +1 -0
  36. package/lib/iov-pro-components.min.js +7 -0
  37. package/lib/postcss.config.js +8 -0
  38. package/package.json +75 -0
  39. package/patches/vue-server-renderer+2.7.16.patch +13 -0
  40. package/rollup.config.mjs +79 -0
  41. package/src/App.vue +103 -0
  42. package/src/main.js +33 -0
  43. package/src/packages/column-tooltip/index.js +7 -0
  44. package/src/packages/column-tooltip/src/main.vue +127 -0
  45. package/src/packages/description/index.js +7 -0
  46. package/src/packages/description/src/main.vue +375 -0
  47. package/src/packages/description/src/text.vue +103 -0
  48. package/src/packages/dialog-select/index.js +7 -0
  49. package/src/packages/dialog-select/src/main.vue +308 -0
  50. package/src/packages/display/index.js +7 -0
  51. package/src/packages/display/src/main.vue +44 -0
  52. package/src/packages/enums/index.js +7 -0
  53. package/src/packages/enums/src/main.vue +23 -0
  54. package/src/packages/export/index.js +7 -0
  55. package/src/packages/export/src/main.vue +316 -0
  56. package/src/packages/fixed-button-group/index.js +7 -0
  57. package/src/packages/fixed-button-group/src/main.vue +104 -0
  58. package/src/packages/form/index.js +7 -0
  59. package/src/packages/form/src/collapse.vue +149 -0
  60. package/src/packages/form/src/main.vue +1190 -0
  61. package/src/packages/form-collapse/index.js +7 -0
  62. package/src/packages/index.js +86 -0
  63. package/src/packages/link-group/index.js +7 -0
  64. package/src/packages/link-group/src/main.vue +52 -0
  65. package/src/packages/page-detail/index.js +7 -0
  66. package/src/packages/page-detail/src/main.vue +123 -0
  67. package/src/packages/page-module/index.js +7 -0
  68. package/src/packages/page-module/src/main.vue +56 -0
  69. package/src/packages/preview/index.js +7 -0
  70. package/src/packages/preview/src/eval-image-viewer.js +50 -0
  71. package/src/packages/preview/src/image-viewer.vue +366 -0
  72. package/src/packages/preview/src/main.vue +97 -0
  73. package/src/packages/request/index.js +7 -0
  74. package/src/packages/request/src/main.vue +125 -0
  75. package/src/packages/search-table/index.js +7 -0
  76. package/src/packages/search-table/src/inner-tabs.vue +237 -0
  77. package/src/packages/search-table/src/main.vue +472 -0
  78. package/src/packages/search-table/src/outer-tabs.vue +45 -0
  79. package/src/packages/search-table-inner-tabs/index.js +7 -0
  80. package/src/packages/search-table-outer-tabs/index.js +7 -0
  81. package/src/packages/space/index.js +7 -0
  82. package/src/packages/space/src/main.vue +74 -0
  83. package/src/packages/sub-title/index.js +7 -0
  84. package/src/packages/sub-title/src/main.vue +70 -0
  85. package/src/packages/submit-module/index.js +7 -0
  86. package/src/packages/submit-module/src/main.vue +67 -0
  87. package/src/packages/table/index.js +7 -0
  88. package/src/packages/table/src/filter.vue +89 -0
  89. package/src/packages/table/src/main.vue +668 -0
  90. package/src/packages/table/src/search.vue +90 -0
  91. package/src/packages/table/src/sort.vue +118 -0
  92. package/src/packages/theme/index.scss +15 -0
  93. package/src/packages/theme/src/column-tooltip.scss +23 -0
  94. package/src/packages/theme/src/common/color.scss +134 -0
  95. package/src/packages/theme/src/description.scss +56 -0
  96. package/src/packages/theme/src/dialog-select.scss +32 -0
  97. package/src/packages/theme/src/fixed-button-group.scss +25 -0
  98. package/src/packages/theme/src/form.scss +11 -0
  99. package/src/packages/theme/src/link-group.scss +43 -0
  100. package/src/packages/theme/src/page-detail.scss +61 -0
  101. package/src/packages/theme/src/page-module.scss +46 -0
  102. package/src/packages/theme/src/preview.scss +67 -0
  103. package/src/packages/theme/src/search-table.scss +185 -0
  104. package/src/packages/theme/src/space.scss +12 -0
  105. package/src/packages/theme/src/sub-title.scss +47 -0
  106. package/src/packages/theme/src/submit-module.scss +13 -0
  107. package/src/packages/theme/src/table.scss +129 -0
  108. package/src/packages/theme/src/toolbar.scss +109 -0
  109. package/src/packages/toolbar/index.js +7 -0
  110. package/src/packages/toolbar/src/main.vue +126 -0
  111. package/src/packages/toolbar/src/setting.vue +217 -0
  112. package/src/packages/toolbar/src/style.vue +68 -0
  113. package/src/packages/toolbar/src/zoom.vue +65 -0
  114. package/src/router.js +83 -0
  115. package/src/utils/config-center.js +218 -0
  116. package/src/utils/function-eval.js +84 -0
  117. package/src/utils/index.js +104 -0
  118. package/src/views/column-tooltip.vue +37 -0
  119. package/src/views/components/OtherSelect.vue +18 -0
  120. package/src/views/description.vue +60 -0
  121. package/src/views/detail.vue +146 -0
  122. package/src/views/directive/number.js +82 -0
  123. package/src/views/enums.vue +22 -0
  124. package/src/views/export.vue +9 -0
  125. package/src/views/form-collapse.vue +185 -0
  126. package/src/views/form.vue +402 -0
  127. package/src/views/link-group.vue +16 -0
  128. package/src/views/preview.vue +33 -0
  129. package/src/views/request.vue +56 -0
  130. package/src/views/search-table.vue +297 -0
  131. package/src/views/table.vue +145 -0
  132. package/src/views/toolbar.vue +30 -0
  133. package/vue.config.js +22 -0
@@ -0,0 +1,185 @@
1
+ <template>
2
+ <div class="pro-form">
3
+ <iov-pro-form-collapse>
4
+ <template #default="{ status, toggleStatus }">
5
+ <iov-pro-form
6
+ ref="form"
7
+ v-model="value"
8
+ :data-source="dataSource"
9
+ :items="FORM_ITEMS"
10
+ :config="FORM_CONFIG2"
11
+ />
12
+ <el-button
13
+ size="mini"
14
+ type="primary"
15
+ round
16
+ @click="toggleStatus"
17
+ >{{ status === 'expand' ? '收起' : '展开' }}</el-button>
18
+ </template>
19
+ </iov-pro-form-collapse>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+ const FORM_ITEMS = [
25
+ {
26
+ type: 'input',
27
+ label: '姓名',
28
+ name: 'name',
29
+ rules: {
30
+ required: true,
31
+ message: '请输入姓名',
32
+ trigger: 'blur'
33
+ }
34
+ },
35
+ {
36
+ type: 'input',
37
+ label: '年龄',
38
+ name: 'age',
39
+ value: 18,
40
+ props: {
41
+ placeholder: '请输入年龄'
42
+ },
43
+ rules: {
44
+ required: true,
45
+ message: '请输入姓名',
46
+ trigger: 'blur'
47
+ }
48
+ },
49
+ {
50
+ type: 'select',
51
+ label: '性别',
52
+ name: 'sex',
53
+ value: options => options[0]?.value,
54
+ options: [
55
+ { label: '男', value: 1 },
56
+ { label: '女', value: 2 }
57
+ ]
58
+ },
59
+ {
60
+ type: 'radio-button',
61
+ label: '是否抽烟',
62
+ name: 'smoke',
63
+ value: 1,
64
+ options: [
65
+ { label: '是', value: 1 },
66
+ { label: '否', value: 2 }
67
+ ]
68
+ },
69
+ {
70
+ type: 'select',
71
+ label: ({ sex }) => `最喜欢的${sex === 1 ? '男性' : '女性'}运动`,
72
+ name: 'sport',
73
+ watch: ['sex'],
74
+ labelWidth: '140px',
75
+ value: options => options[0]?.value,
76
+ rules: ({ sex }) => {
77
+ return sex === 1 ? { required: true, message: '请选择' } : null
78
+ },
79
+ props: {
80
+ handler({ sex }) {
81
+ return sex === 2 ? { clearable: false } : {}
82
+ }
83
+ },
84
+ options({ sex }) {
85
+ if (!sex) {
86
+ return new Promise((resolve) => {
87
+ setTimeout(() => {
88
+ resolve([])
89
+ }, 100)
90
+ })
91
+ }
92
+ return new Promise((resolve) => {
93
+ setTimeout(() => {
94
+ if (sex === 1) {
95
+ resolve([
96
+ { label: '足球', value: 1 },
97
+ { label: '篮球', value: 2 }
98
+ ])
99
+ } else {
100
+ resolve([
101
+ { label: '乒乓球', value: 3 },
102
+ { label: '羽毛球', value: 4 }
103
+ ])
104
+ }
105
+ }, 300)
106
+ })
107
+ }
108
+ },
109
+ {
110
+ type: 'checkbox',
111
+ name: 'location',
112
+ label: '喜欢去的场所',
113
+ labelWidth: '110px',
114
+ span: 12,
115
+ watch: ['sex', 'dataSource.other'],
116
+ options: {
117
+ handler({ sex }, dataSource) {
118
+ return new Promise((resolve) => {
119
+ setTimeout(() => {
120
+ const options = [
121
+ { label: '足球', value: 1 },
122
+ { label: '篮球', value: 2 }
123
+ ]
124
+ if (sex === 1) {
125
+ options.push({ label: '翠林', value: 3 })
126
+ }
127
+ if (sex === 2) {
128
+ options.push({ label: '美容院', value: 4 })
129
+ }
130
+ if (dataSource.other === 1) {
131
+ options.push({ label: '其他1', value: 5 })
132
+ }
133
+ if (dataSource.other === 2) {
134
+ options.push({ label: '其他2', value: 6 })
135
+ }
136
+ resolve(options)
137
+ }, 300)
138
+ })
139
+ },
140
+ inject: ['dataSource']
141
+ }
142
+ },
143
+ {
144
+ type: 'date-picker',
145
+ label: '毕业时间',
146
+ span: 12,
147
+ name: ['startTime', 'endTime'],
148
+ props: {
149
+ type: 'daterange'
150
+ },
151
+ value: ['2024-10-01 00:00:00', '2024-11-01 00:00:00']
152
+ }
153
+ ]
154
+
155
+ const FORM_CONFIG1 = {
156
+ grid: false,
157
+ labelPosition: 'top'
158
+ }
159
+
160
+ const FORM_CONFIG2 = {
161
+ grid: true,
162
+ span: 6,
163
+ gutter: 20
164
+ }
165
+ export default {
166
+ name: 'FormCollapseDemo',
167
+ data() {
168
+ return {
169
+ value: {},
170
+ FORM_ITEMS,
171
+ FORM_CONFIG1,
172
+ FORM_CONFIG2,
173
+ dataSource: {
174
+ other: 1
175
+ }
176
+ }
177
+ }
178
+ }
179
+ </script>
180
+
181
+ <style lang="scss">
182
+ .pro-form {
183
+ padding: 20px;
184
+ }
185
+ </style>
@@ -0,0 +1,402 @@
1
+ <template>
2
+ <div class="pro-form">
3
+ <el-tabs value="no-grid">
4
+ <el-tab-pane
5
+ name="no-grid"
6
+ label="非栅格系统"
7
+ >
8
+ <iov-pro-form
9
+ ref="form"
10
+ v-model="value"
11
+ :data-source="dataSource"
12
+ :items="FORM_ITEMS"
13
+ :config="FORM_CONFIG1"
14
+ @change="onChange"
15
+ >
16
+ <template #name-form-item-label>1111</template>
17
+ <template #name-suffix><div>23</div></template>
18
+ <template #name-prefix><div>45</div></template>
19
+ <template #smoke-time>
20
+ <el-input
21
+ v-model="value.time"
22
+ placeholder="请输入抽烟时长"
23
+ clearable
24
+ >
25
+ <el-select
26
+ slot="append"
27
+ v-model="value.unit"
28
+ placeholder="请选择单位"
29
+ >
30
+ <el-option
31
+ label="年"
32
+ value="year"
33
+ />
34
+ <el-option
35
+ label="月"
36
+ value="month"
37
+ />
38
+ <el-option
39
+ label="日"
40
+ value="day"
41
+ />
42
+ </el-select>
43
+ </el-input>
44
+ </template>
45
+ </iov-pro-form>
46
+ </el-tab-pane>
47
+ <el-tab-pane
48
+ name="grid"
49
+ label="栅格系统"
50
+ >
51
+ <iov-pro-form
52
+ ref="form"
53
+ v-model="value"
54
+ :data-source="dataSource"
55
+ :items="FORM_ITEMS"
56
+ :config="FORM_CONFIG2"
57
+ @change="onChange"
58
+ />
59
+ </el-tab-pane>
60
+ </el-tabs>
61
+ <el-input
62
+ ref="input"
63
+ v-model="value1"
64
+ v-number="2"
65
+ />
66
+
67
+ <el-button @click="onValidateForm">校验表单</el-button>
68
+ <el-button @click="onClearValidateForm">清空校验</el-button>
69
+ <el-button @click="getFormOptions">获取options数据</el-button>
70
+ <el-button @click="resetForm">重置表单</el-button>
71
+ <el-button @click="onChangeDataSource">更改数据源</el-button>
72
+ <div>{{ value }}</div>
73
+ </div>
74
+ </template>
75
+
76
+ <script>
77
+ import lodashGet from 'lodash/get'
78
+
79
+ const FORM_ITEMS = [
80
+ {
81
+ type: 'input',
82
+ label: '姓名',
83
+ name: 'name',
84
+ rules: {
85
+ required: true,
86
+ message: '请输入姓名',
87
+ trigger: 'blur'
88
+ },
89
+ directive: 'model.trim',
90
+ slots: {
91
+ formItem: {
92
+ label: 'name-form-item-label'
93
+ },
94
+ component: {
95
+ suffix: 'name-suffix',
96
+ prefix: 'name-prefix'
97
+ }
98
+ }
99
+ },
100
+ {
101
+ type: 'input',
102
+ label: '年龄',
103
+ name: 'age',
104
+ value: 18,
105
+ props: {
106
+ class: 'input-age',
107
+ placeholder: '请输入年龄'
108
+ },
109
+ directive: {
110
+ name: 'number',
111
+ value: 2
112
+ },
113
+ rules: {
114
+ required: true,
115
+ message: '请输入年龄',
116
+ trigger: 'blur'
117
+ }
118
+ },
119
+ {
120
+ type: 'select',
121
+ label: '性别',
122
+ name: 'sex',
123
+ value: options => options[0]?.value,
124
+ props: {
125
+ filterable: true,
126
+ remote: true,
127
+ remoteMethod: {
128
+ handler(query, options) {
129
+ return query ? options.slice(0, 1) : options
130
+ },
131
+ inject: ['options']
132
+ }
133
+ },
134
+ options: [
135
+ { label: '男', value: 1 },
136
+ { label: '女', value: 2 }
137
+ ],
138
+ on: {
139
+ input: {
140
+ handler(value, formThis) {
141
+ console.log(value, formThis)
142
+ },
143
+ inject: ['formThis']
144
+ },
145
+ change(value) {
146
+ console.log(value)
147
+ }
148
+ }
149
+ },
150
+ {
151
+ type: 'radio',
152
+ label: '是否抽烟',
153
+ name: 'smoke',
154
+ value: 1,
155
+ vif: ({ sex }) => sex === 1,
156
+ options: [
157
+ { label: '是', value: 1 },
158
+ { label: '否', value: 2 }
159
+ ]
160
+ },
161
+ {
162
+ type: 'slot',
163
+ label: '抽烟时长',
164
+ name: ['time', 'unit'],
165
+ slotName: 'smoke-time',
166
+ vif: ({ smoke }) => smoke === 1,
167
+ value: ['', 'year'],
168
+ rules: {
169
+ required: true,
170
+ validator(rule, value, callback) {
171
+ if (!value[0]) {
172
+ callback(new Error('请输入抽烟时长'))
173
+ } else {
174
+ callback()
175
+ }
176
+ },
177
+ trigger: 'blur'
178
+ }
179
+ },
180
+ {
181
+ type: 'select',
182
+ label: ({ sex }) => `最喜欢的${sex === 1 ? '男性' : '女性'}运动`,
183
+ name: 'sport',
184
+ watch: ['sex'],
185
+ labelWidth: '140px',
186
+ value: '',
187
+ rules: ({ sex }) => {
188
+ return sex === 1 ? { required: true, message: '请选择' } : null
189
+ },
190
+ props: {
191
+ handler({ sex }) {
192
+ return sex === 2 ? { clearable: false } : {}
193
+ },
194
+ inject: ['dataSource']
195
+ },
196
+ options({ sex }) {
197
+ console.log('sex 的 options 触发了', sex)
198
+ if (!sex) {
199
+ return new Promise((resolve) => {
200
+ setTimeout(() => {
201
+ resolve([])
202
+ }, 100)
203
+ })
204
+ }
205
+ return new Promise((resolve) => {
206
+ setTimeout(() => {
207
+ if (sex === 1) {
208
+ resolve([
209
+ { label: '全部', value: '' },
210
+ { label: '足球', value: 1 },
211
+ { label: '篮球', value: 2 }
212
+ ])
213
+ } else {
214
+ resolve([
215
+ { label: '全部', value: '' },
216
+ { label: '乒乓球', value: 3 },
217
+ { label: '羽毛球', value: 4 }
218
+ ])
219
+ }
220
+ }, 300)
221
+ })
222
+ }
223
+ },
224
+ {
225
+ type: 'checkbox',
226
+ name: 'location',
227
+ label: '喜欢去的场所',
228
+ labelWidth: '110px',
229
+ span: 12,
230
+ watch: ['sex', 'dataSource.other'],
231
+ options: {
232
+ handler({ sex }, dataSource) {
233
+ return new Promise((resolve) => {
234
+ setTimeout(() => {
235
+ const options = [
236
+ { label: '足球', value: 1 },
237
+ { label: '篮球', value: 2 }
238
+ ]
239
+ if (sex === 1) {
240
+ options.push({ label: '翠林', value: 3 })
241
+ }
242
+ if (sex === 2) {
243
+ options.push({ label: '美容院', value: 4 })
244
+ }
245
+ if (dataSource.other === 1) {
246
+ options.push({ label: '其他1', value: 5 })
247
+ }
248
+ if (dataSource.other === 2) {
249
+ options.push({ label: '其他2', value: 6 })
250
+ }
251
+ resolve(options)
252
+ }, 100)
253
+ })
254
+ },
255
+ inject: ['dataSource']
256
+ }
257
+ },
258
+ {
259
+ type: 'date-picker',
260
+ label: '毕业时间',
261
+ span: 12,
262
+ name: ['startTime', 'endTime'],
263
+ props: {
264
+ type: 'daterange'
265
+ },
266
+ value: ['2024-10-01 00:00:00', '2024-11-01 00:00:00']
267
+ }
268
+ ]
269
+
270
+ const FORM_CONFIG1 = {
271
+ grid: false,
272
+ labelPosition: 'top'
273
+ }
274
+
275
+ const FORM_CONFIG2 = {
276
+ grid: true,
277
+ span: 6,
278
+ gutter: 20
279
+ }
280
+ export default {
281
+ name: 'FormDemo',
282
+ directives: {
283
+ number: {
284
+ bind(el, binding, vnode) {
285
+ const decimals = !isNaN(binding.value) ? binding.value : 2 // 默认小数位数为 2
286
+
287
+ // 构建正则表达式,支持 0 和空值,不允许以 '.' 开头,也不允许多个零开头
288
+ const regex = new RegExp(`^(?!\\.)[0-9]*(\\.\\d{0,${decimals}})?$|^$`)
289
+
290
+ // 获取 el-input 内部的 input 元素
291
+ const input = el.tagName === 'INPUT' ? el : el.querySelector('input')
292
+ if (input) {
293
+ let previousValue = '' // 记录上次合法的值
294
+
295
+ input.addEventListener('input', (event) => {
296
+ let currentValue = input.value
297
+
298
+ // 使用 slice 去除多余的零
299
+ if (/^0[0-9]/.test(currentValue)) {
300
+ currentValue = currentValue.slice(0, 1) // 保留一个零,移除其他零
301
+ }
302
+
303
+ // 防止以小数点开头,例如 ".123" -> "0.123"
304
+ if (/^\./.test(currentValue)) {
305
+ currentValue = '0' + currentValue // 补全为 "0.123"
306
+ }
307
+
308
+ if (+decimals === 0 && /^\d+\.$/.test(currentValue)) {
309
+ currentValue = currentValue.slice(0, -1)
310
+ }
311
+
312
+ // 如果当前值合法,保存为上次合法值
313
+ if (regex.test(currentValue)) {
314
+ previousValue = currentValue
315
+ input.value = previousValue
316
+ } else {
317
+ // 如果不合法,恢复到上次合法值
318
+ const cursorPosition = input.selectionStart - 1 // 获取光标位置
319
+ input.value = previousValue // 恢复到合法值
320
+
321
+ // 修复光标位置
322
+ input.setSelectionRange(cursorPosition, cursorPosition)
323
+
324
+ // 手动触发 input 事件以更新 v-model
325
+ const event = new Event('input', { bubbles: true })
326
+ input.dispatchEvent(event)
327
+ }
328
+ // 如果当前正在合成,则关闭合成方法
329
+ if (lodashGet(vnode, 'componentInstance.isComposing')) {
330
+ // 设置当前未在合成
331
+ vnode.componentInstance.isComposing = false
332
+ vnode.componentInstance.handleInput(event)
333
+ }
334
+ })
335
+ input.addEventListener('blur', () => {
336
+ // 当前输入的值
337
+ const currentValue = input.value
338
+ // 如果当前输入的值以.结尾
339
+ if (/\.$/.test(currentValue)) {
340
+ previousValue = currentValue.slice(0, currentValue.length - 1)
341
+ input.value = previousValue
342
+ // 手动触发 input 事件以更新 v-model
343
+ const event = new Event('input', { bubbles: true })
344
+ input.dispatchEvent(event)
345
+ }
346
+ })
347
+ }
348
+ },
349
+ unbind(el) {
350
+ const input = el.tagName === 'INPUT' ? el : el.querySelector('input')
351
+ if (input) {
352
+ input.removeEventListener('input', () => {})
353
+ input.removeEventListener('blur', () => {})
354
+ }
355
+ }
356
+ }
357
+ },
358
+ data() {
359
+ return {
360
+ value: {},
361
+ FORM_ITEMS,
362
+ FORM_CONFIG1,
363
+ FORM_CONFIG2,
364
+ dataSource: {
365
+ other: 1
366
+ },
367
+ value1: ''
368
+ }
369
+ },
370
+ methods: {
371
+ onValidateForm() {
372
+ this.$refs.form.validate()
373
+ },
374
+
375
+ onClearValidateForm() {
376
+ this.$refs.form.clearValidate()
377
+ },
378
+
379
+ getFormOptions() {
380
+ console.log(this.$refs.form.getOptions(['sport']))
381
+ },
382
+
383
+ resetForm() {
384
+ this.$refs.form.resetFields()
385
+ },
386
+
387
+ onChange(newValue, oldValue) {
388
+ console.log(newValue, oldValue)
389
+ },
390
+
391
+ onChangeDataSource() {
392
+ this.dataSource.other = 2
393
+ }
394
+ }
395
+ }
396
+ </script>
397
+
398
+ <style lang="scss">
399
+ .pro-form {
400
+ padding: 20px;
401
+ }
402
+ </style>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <iov-pro-link-group max="2">
3
+ <el-link type="primary">详情</el-link>
4
+ <el-link type="primary">编辑</el-link>
5
+ <el-link type="primary">删除</el-link>
6
+ <el-link type="primary">启用</el-link>
7
+ <el-link type="primary">启用2</el-link>
8
+ </iov-pro-link-group>
9
+ </template>
10
+
11
+ <script>
12
+
13
+ export default {
14
+ name: 'LinkGroupDemo'
15
+ }
16
+ </script>
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <Preview :name="pageName" :key="pageName" />
3
+ </template>
4
+
5
+ <script>
6
+ import Preview from '../components/Preview'
7
+
8
+ export default {
9
+ name: 'PreiviewPage',
10
+ components: {
11
+ Preview
12
+ },
13
+ data() {
14
+ return {
15
+ pageName: ''
16
+ }
17
+ },
18
+ watch: {
19
+ $route: {
20
+ handler() {
21
+ this.pageName = this.$route.path.replace('/preview/', '')
22
+ },
23
+ immediate: true
24
+ }
25
+ }
26
+ }
27
+ </script>
28
+
29
+ <style lang="scss">
30
+ .result-box {
31
+ width: 1016px;
32
+ }
33
+ </style>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <div>
3
+ <button @click="onRetry">重新发起请求</button>
4
+ <div style="max-height: 300px; overflow-y: auto">
5
+ <div>结果如下:</div>
6
+ <iov-pro-request
7
+ :api="api"
8
+ :params="params"
9
+ >
10
+ <template #default="{ data, loading }">
11
+ <div>
12
+ <div>loading: {{ loading }}</div>
13
+ <div>data: {{ data }}</div>
14
+ </div>
15
+ </template>
16
+ </iov-pro-request>
17
+ <iov-pro-request
18
+ :api="api"
19
+ :params="params"
20
+ />
21
+ </div>
22
+ </div>
23
+ </template>
24
+
25
+ <script>
26
+ const api = (params) => fetch(
27
+ 'https://www.zhihu.com/commercial_api/banners_v3/home_up',
28
+ {
29
+ method: 'GET',
30
+ params: JSON.stringify(params)
31
+ }
32
+ ).then(res => res.json())
33
+
34
+ export default {
35
+ name: 'RequestDemo',
36
+ data() {
37
+ return {
38
+ api,
39
+ params: {
40
+ tenantNo: 39
41
+ }
42
+ }
43
+ },
44
+ methods: {
45
+ /**
46
+ * 重新调用接口
47
+ * @time 2024-10-30 10:49:04
48
+ */
49
+ onRetry() {
50
+ this.params = {
51
+ tenantNo: Math.floor(Math.random() * 100)
52
+ }
53
+ }
54
+ }
55
+ }
56
+ </script>