btxui 1.0.2 → 1.0.5

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 (194) hide show
  1. package/favicon.png +0 -0
  2. package/index.js +3289 -0
  3. package/index.js.gz +0 -0
  4. package/index.umd.cjs +1 -0
  5. package/package.json +11 -23
  6. package/README.md +0 -42
  7. package/app.vue +0 -162
  8. package/assets/css/_main.js +0 -73
  9. package/assets/css/btx.min.css +0 -1
  10. package/assets/css/btx.mob.min.css +0 -1
  11. package/assets/css/btx.pad.min.css +0 -1
  12. package/assets/css/btx.webapp.min.css +0 -1
  13. package/assets/css/custom_fonts/iconfont.css +0 -37
  14. package/assets/css/custom_fonts/iconfont.eot +0 -0
  15. package/assets/css/custom_fonts/iconfont.svg +0 -47
  16. package/assets/css/custom_fonts/iconfont.ttf +0 -0
  17. package/assets/css/custom_fonts/iconfont.woff +0 -0
  18. package/assets/css/custom_fonts/iconfont.woff2 +0 -0
  19. package/assets/css/res-l.css +0 -47
  20. package/assets/css/res-m.css +0 -47
  21. package/assets/css/res-s.css +0 -61
  22. package/assets/custom_fonts/iconfont.css +0 -37
  23. package/assets/custom_fonts/iconfont.eot +0 -0
  24. package/assets/custom_fonts/iconfont.svg +0 -47
  25. package/assets/custom_fonts/iconfont.ttf +0 -0
  26. package/assets/custom_fonts/iconfont.woff +0 -0
  27. package/assets/custom_fonts/iconfont.woff2 +0 -0
  28. package/assets/js/Btx.js +0 -196
  29. package/assets/js/Utils.js +0 -421
  30. package/assets/js/fastclick.js +0 -802
  31. package/assets/js/lazy.min.js +0 -2
  32. package/assets/js/touchwipe.js +0 -111
  33. package/assets/server.js +0 -8
  34. package/assets/start_site_code_str.js +0 -119
  35. package/cdn/css/btx.min.css +0 -1
  36. package/cdn/css/btx.min.css.map +0 -1
  37. package/cdn/fonts/iconfont.ttf +0 -0
  38. package/cdn/fonts/iconfont.woff +0 -0
  39. package/cdn/fonts/iconfont.woff2 +0 -0
  40. package/components/BTXUI/app/app-wid.vue +0 -182
  41. package/components/BTXUI/btn/btn-wid.vue +0 -128
  42. package/components/BTXUI/carousel/carousel-wid.vue +0 -138
  43. package/components/BTXUI/checkbox/checkbox-wid.vue +0 -72
  44. package/components/BTXUI/confirm/confirm-wid.vue +0 -279
  45. package/components/BTXUI/content/content-checkbox-wid.vue +0 -44
  46. package/components/BTXUI/content/content-node-wid.vue +0 -114
  47. package/components/BTXUI/content/content-tag-wid.vue +0 -25
  48. package/components/BTXUI/content/content-wid.vue +0 -254
  49. package/components/BTXUI/core/anis/ani-fail.vue +0 -46
  50. package/components/BTXUI/core/anis/ani-loading.vue +0 -32
  51. package/components/BTXUI/core/anis/ani-notic.vue +0 -47
  52. package/components/BTXUI/core/anis/ani-success.vue +0 -48
  53. package/components/BTXUI/core/b-drag.vue +0 -258
  54. package/components/BTXUI/core/b-grid.vue +0 -84
  55. package/components/BTXUI/core/b-hot.vue +0 -171
  56. package/components/BTXUI/core/b-icon.vue +0 -76
  57. package/components/BTXUI/core/b-img.vue +0 -84
  58. package/components/BTXUI/core/b-input.vue +0 -198
  59. package/components/BTXUI/core/b-list.vue +0 -276
  60. package/components/BTXUI/core/b-text/doc.ts +0 -9
  61. package/components/BTXUI/core/b-text/index.vue +0 -16
  62. package/components/BTXUI/core/b-textarea.vue +0 -58
  63. package/components/BTXUI/core/b-video.vue +0 -35
  64. package/components/BTXUI/core/b-view/doc.ts +0 -10
  65. package/components/BTXUI/core/b-view/index.vue +0 -20
  66. package/components/BTXUI/core/b-webview.vue +0 -20
  67. package/components/BTXUI/core/lib/ChapterLink.js +0 -49
  68. package/components/BTXUI/core/lib/Search.vue +0 -60
  69. package/components/BTXUI/core/styles/doc.ts +0 -55
  70. package/components/BTXUI/core/styles/index.vue +0 -98
  71. package/components/BTXUI/core/styles/prestyles.ts +0 -471
  72. package/components/BTXUI/core/styles/theme.ts +0 -29
  73. package/components/BTXUI/drawer/drawer-wid.vue +0 -165
  74. package/components/BTXUI/drawer/title-tag-wid.vue +0 -114
  75. package/components/BTXUI/form/form-select-wid.vue +0 -57
  76. package/components/BTXUI/form/form-wid.vue +0 -324
  77. package/components/BTXUI/formPannel/form-pannel-wid.vue +0 -133
  78. package/components/BTXUI/imgsUpload/imgs-upload-wid.vue +0 -149
  79. package/components/BTXUI/index.js +0 -83
  80. package/components/BTXUI/pageFlip/page-flip-wid.vue +0 -206
  81. package/components/BTXUI/pannel/pannel-wid.vue +0 -167
  82. package/components/BTXUI/range/range-wid.vue +0 -134
  83. package/components/BTXUI/search/search-wid.vue +0 -80
  84. package/components/BTXUI/select/select-wid.vue +0 -186
  85. package/components/BTXUI/slider/slider-wid.vue +0 -444
  86. package/components/BTXUI/tab/tab-wid.vue +0 -109
  87. package/components/BTXUI/table/table-wid.vue +0 -324
  88. package/components/BTXUI/tag/tag-wid.vue +0 -183
  89. package/components/BTXUI/tags/tags-wid.vue +0 -121
  90. package/components/BTXUI/tooltip/tooltip-wid.vue +0 -146
  91. package/components/BTXUI/upload/upload-wid.vue +0 -215
  92. package/components/BTXUI/waterfall/waterfall-wid.vue +0 -166
  93. package/components/header-info.vue +0 -167
  94. package/composables/@types.ts +0 -4
  95. package/composables/api.ts +0 -18
  96. package/env.d.ts +0 -5
  97. package/main.js +0 -16
  98. package/nuxt.config.ts +0 -51
  99. package/pages/article.vue +0 -16
  100. package/pages/download.vue +0 -50
  101. package/pages/example/app_wid/app/data_demo.vue +0 -9
  102. package/pages/example/app_wid/app/download_demo.vue +0 -9
  103. package/pages/example/app_wid/app/list_demo.vue +0 -11
  104. package/pages/example/app_wid/app/system_demo.vue +0 -9
  105. package/pages/example/app_wid/app_wid_demo.vue +0 -198
  106. package/pages/example/app_wid/btn_wid_demo.vue +0 -179
  107. package/pages/example/app_wid/carousel_wid_demo.vue +0 -152
  108. package/pages/example/app_wid/checkbox_wid_demo.vue +0 -65
  109. package/pages/example/app_wid/confirm_wid_demo.vue +0 -197
  110. package/pages/example/app_wid/content_wid_demo.vue +0 -369
  111. package/pages/example/app_wid/drawer_wid_demo.vue +0 -155
  112. package/pages/example/app_wid/form_pannel_wid_demo.vue +0 -338
  113. package/pages/example/app_wid/form_wid_demo.vue +0 -550
  114. package/pages/example/app_wid/imgs_upload_wid_demo.vue +0 -159
  115. package/pages/example/app_wid/index.js +0 -158
  116. package/pages/example/app_wid/page_flip_wid_demo.vue +0 -99
  117. package/pages/example/app_wid/pannel_wid_demo.vue +0 -177
  118. package/pages/example/app_wid/range_wid_demo.vue +0 -101
  119. package/pages/example/app_wid/search_wid_demo.vue +0 -75
  120. package/pages/example/app_wid/select_wid_demo.vue +0 -217
  121. package/pages/example/app_wid/slider_wid_demo.vue +0 -143
  122. package/pages/example/app_wid/tab_wid_demo.vue +0 -170
  123. package/pages/example/app_wid/table_wid_demo.vue +0 -377
  124. package/pages/example/app_wid/tag_wid_demo.vue +0 -133
  125. package/pages/example/app_wid/tags_wid_demo.vue +0 -143
  126. package/pages/example/app_wid/tooltip_wid_demo.vue +0 -117
  127. package/pages/example/app_wid/upload_wid_demo.vue +0 -123
  128. package/pages/example/base_wid/b_drag_demo.vue +0 -159
  129. package/pages/example/base_wid/b_grid_demo.vue +0 -225
  130. package/pages/example/base_wid/b_hot_demo.vue +0 -135
  131. package/pages/example/base_wid/b_icon_demo.vue +0 -80
  132. package/pages/example/base_wid/b_img_demo.vue +0 -95
  133. package/pages/example/base_wid/b_input_demo.vue +0 -171
  134. package/pages/example/base_wid/b_list_demo.vue +0 -241
  135. package/pages/example/base_wid/b_style_demo.vue +0 -928
  136. package/pages/example/base_wid/b_text_demo.vue +0 -36
  137. package/pages/example/base_wid/b_textarea_demo.vue +0 -64
  138. package/pages/example/base_wid/b_video_demo.vue +0 -42
  139. package/pages/example/base_wid/b_view_demo.vue +0 -36
  140. package/pages/example/base_wid/index.js +0 -76
  141. package/pages/example/content.js +0 -49
  142. package/pages/example/global_style/animation.vue +0 -197
  143. package/pages/example/global_style/color.vue +0 -134
  144. package/pages/example/global_style/decoration.vue +0 -546
  145. package/pages/example/global_style/icon.vue +0 -345
  146. package/pages/example/global_style/index.js +0 -52
  147. package/pages/example/global_style/layout.vue +0 -846
  148. package/pages/example/global_style/special.vue +0 -37
  149. package/pages/example/global_style/table.vue +0 -298
  150. package/pages/example/global_style/text.vue +0 -159
  151. package/pages/index.vue +0 -43
  152. package/pages/level_widget.vue +0 -11
  153. package/pages/start.vue +0 -200
  154. package/plugins/index.ts +0 -2
  155. package/public/favicon.gif +0 -0
  156. package/public/fonts/iconfont.ttf +0 -0
  157. package/public/fonts/iconfont.woff +0 -0
  158. package/public/fonts/iconfont.woff2 +0 -0
  159. package/public/img/banner.jpg +0 -0
  160. package/public/img/banner2.jpg +0 -0
  161. package/public/img/bg_pattern.png +0 -0
  162. package/public/img/btx.jpg +0 -0
  163. package/public/img/btx_ui.jpg +0 -0
  164. package/public/img/dir.png +0 -0
  165. package/public/img/f.png +0 -0
  166. package/public/img/head.jpg +0 -0
  167. package/public/img/head2.jpg +0 -0
  168. package/public/img/home_ico.png +0 -0
  169. package/public/img/icons.svg +0 -164
  170. package/public/img/mechanism/b-style.png +0 -0
  171. package/public/img/mechanism/slider-wid.png +0 -0
  172. package/public/img/mechanism/upload-wid.png +0 -0
  173. package/public/img/transform_origin.png +0 -0
  174. package/sass/animation.scss +0 -400
  175. package/sass/btx.mob.scss +0 -10
  176. package/sass/btx.pad.scss +0 -3
  177. package/sass/btx.scss +0 -22
  178. package/sass/btx.webapp.scss +0 -22
  179. package/sass/colors.scss +0 -65
  180. package/sass/decoration.scss +0 -220
  181. package/sass/flex.scss +0 -29
  182. package/sass/icons.scss +0 -100
  183. package/sass/layout.scss +0 -88
  184. package/sass/reset.scss +0 -111
  185. package/sass/response/flex_mixin.scss +0 -91
  186. package/sass/response/layout_mixin.scss +0 -227
  187. package/sass/response/main.scss +0 -59
  188. package/sass/response/text_mixin.scss +0 -65
  189. package/sass/scroll.scss +0 -100
  190. package/sass/special.scss +0 -13
  191. package/sass/table.scss +0 -103
  192. package/sass/text.scss +0 -86
  193. package/sass/webpack.config.js +0 -31
  194. package/tsconfig.json +0 -4
@@ -1,324 +0,0 @@
1
- <template>
2
- <b-view :styles="`line thick-1 pleft round-sm no-scroll line-${colors.outline}`">
3
- <!--表头-->
4
- <b-view :styles="`flex-4 bold bg-color-${colors.thead}`">
5
-
6
- <!--复选表头单元格-->
7
- <b-view :styles="`flex-4 alpha-0 trans-fast w-0 thick-1 line-r line-${colors.line}`"
8
- :states="{
9
- show: {
10
- style: 'alpha-1 w-10 pad-l-1',
11
- state: checkbox_td_state
12
- }
13
- }">
14
- <checkbox-wid id="selectAll" text="All" v-model="select_all_state" />
15
- </b-view>
16
-
17
- <b-view v-for="(th, n) of thead" :key="n"
18
- :styles="`pad-.7 thick-1 ${n>0? 'line-l': ''} line-${colors.line} ${$_set_td_width(thead[n])}`"
19
- v-html="th.title">
20
- </b-view>
21
- </b-view>
22
-
23
- <!--表身-->
24
- <component v-for="(tr, i) of tbody.slice(0, show_rows)"
25
- :key="i"
26
- :is="hover_tr_color? 'b-hot': 'b-view'"
27
- :styles="`flex line-t thick-1 line-${colors.line} bg-color-${i%2? colors.row.even: colors.row.odd}`"
28
- :hover="hover_tr_color? 'bg-color-' + hover_tr_color: ''"
29
- @on_click="$_click(i)">
30
-
31
- <!--复选表身单元格-->
32
- <b-view :styles="`flex-4 alpha-0 trans-fast w-0 thick-1 line-r line-${colors.line}`"
33
- :states="{
34
- show: {
35
- style: 'alpha-1 w-10 pad-l-1.4',
36
- state: checkbox_td_state
37
- }
38
- }">
39
- <checkbox-wid :id="i" v-model="tbody_data[i]" />
40
- </b-view>
41
-
42
- <b-view v-for="(data, k) of tr"
43
- :key="k"
44
- :styles="`flex-4 pad-h-.7 pad-v-.4 thick-1 ${k>0? 'line-l': ''} line-${colors.line} ${k==0? 'bg-color-' + colors.row.head: ''} ${$_set_td_width(thead[k])}`" >
45
-
46
- <!--单元格标签按钮-->
47
- <tag-wid v-if="data.tag_data" :id="i" v-bind="data.tag_data" v-model="data.selected" @on_click="data.callback" />
48
-
49
- <!--单元格图片-->
50
- <b-img v-else-if="data.src"
51
- :key="`${i}-${k}-${Math.random() * 1000}`"
52
- :img="data.src"
53
- :defaultSrc="data.default_src"
54
- :styles="`round-sm w-${data.width || 'auto'} h-${data.height || 'auto'}`" />
55
-
56
- <!--单元格文本-->
57
- <b-text v-else v-html="data"></b-text>
58
-
59
- </b-view>
60
- </component>
61
-
62
- <!--折叠按钮-->
63
- <b-view v-if="collapse" styles="flex-2 pad-v-2">
64
- <tag-wid v-bind="toggle_tag.data" v-model="toggle_tag.selected" />
65
- </b-view>
66
- </b-view>
67
- </template>
68
-
69
- <script>
70
- import BView from "@/components/BTXUI/core/b-view"
71
- import BImg from "@/components/BTXUI/core/b-img"
72
- import BText from "@/components/BTXUI/core/b-text"
73
- import BHot from "@/components/BTXUI/core/b-hot"
74
- import TagWid from "@/components/BTXUI/tag/tag-wid"
75
- import CheckboxWid from "@/components/BTXUI/checkbox/checkbox-wid"
76
-
77
- const desc = ["该组件用于显示表格数据。"],
78
- extend = [],
79
- dependent = ["checkbox-wid", "tag-wid", "b-img", "b-hot", "b-text", "b-view"],
80
- api = {
81
- event: [
82
- {
83
- name: "on_click",
84
- ef: "单元行点击触发",
85
- params: "row_index"
86
- },
87
- {
88
- name: "on_select",
89
- ef: "单元格复选框勾选触发",
90
- params: "selected_rows"
91
- }
92
- ],
93
- methods: [
94
- {
95
- name: "enable_row_select",
96
- ef: "开启单元行选择模式",
97
- params: "-",
98
- return: "-"
99
- },
100
- {
101
- name: "disable_row_select",
102
- ef: "关闭单元行选择模式",
103
- params: "-",
104
- return: "-"
105
- },
106
- {
107
- name: "enable_row_click",
108
- ef: "开启单元行点击模式",
109
- params: "-",
110
- return: "-"
111
- },
112
- {
113
- name: "disable_row_click",
114
- ef: "关闭单元行点击模式",
115
- params: "-",
116
- return: "-"
117
- }
118
- ]
119
- },
120
- init_data = `{
121
- thead: "[
122
- {
123
- title: "标题文本"
124
- grow: "自生长比率,默认为 1",
125
- width: "单元格宽度,可缺省,效果优先级大于 grow"
126
- },...
127
- ]",
128
- tbody: "[
129
- [ "对应表头标题数据" | {
130
- src: "图片地址",
131
- default_src: "缺省图片地址",
132
- width: "图片宽度,可缺省",
133
- height: "图片高度,可缺省"
134
- } | {
135
- tag_data: "(参照:tag-wid 组件入参,id 字段无效,自动设置为行索引)",
136
- selected: "默认选中状态"
137
- callback: "点击回调函数"
138
- },... ],...
139
- ]",
140
- /* colors: {
141
- thead: "标题背景色",
142
- row: {
143
- head: "行首色",
144
- odd: "奇数行色",
145
- even: "偶数行色",
146
- hover: "行悬停色,默认无效果"
147
- },
148
- line: "表格描边色",
149
- outline: "表格轮廓色"
150
- } */,
151
- /* collapse: {
152
- rows: "折叠显示单元行数目",
153
- tag_data: "(参照:tag-wid 组件入参,id 字段无效,自动设置为随机数)"
154
- } */,
155
- }`;
156
-
157
- export default {
158
- name: "table-wid",
159
- introduce: { desc, extend, dependent, api, init_data },
160
- components: {
161
- BView,
162
- BImg,
163
- BHot,
164
- BText,
165
- TagWid,
166
- CheckboxWid
167
- },
168
- props: {
169
- thead: {
170
- type: Array,
171
- required: true
172
- },
173
- tbody: {
174
- type: Array,
175
- required: true
176
- },
177
- colors: {
178
- type: Object,
179
- required: false,
180
- default: ()=>{
181
- return {
182
- thead: "none",
183
- row: {
184
- head: "none",
185
- odd: "#f7f7f7",
186
- even: "none",
187
- hover: ""
188
- },
189
- line: "none",
190
- outline: "none"
191
- }
192
- }
193
- },
194
- collapse: {
195
- type: Object,
196
- required: false
197
- }
198
- },
199
- data(){
200
- return {
201
-
202
- //单元行悬停颜色
203
- hover_tr_color: this.colors.row.hover,
204
-
205
- //复选框单元格显示状态
206
- checkbox_td_state: false,
207
-
208
- //表身数据
209
- tbody_data: this.tbody.map(()=>{
210
- return false;
211
- }),
212
-
213
- //全选状态
214
- select_all_state: false,
215
-
216
- //折叠按钮
217
- toggle_tag: {
218
- data: {
219
- text: "展开表格",
220
- actText: "收起表格",
221
- colors: {
222
- normal: {
223
- bg: "rgba(170,170,170,.4)"
224
- },
225
- act: {
226
- bg: "blue"
227
- },
228
- hover: {
229
- bg: "neutral"
230
- },
231
- },
232
- ...(this.collapse? this.collapse.tag_data: {}),
233
- id: Math.floor(Math.random() * 1000),
234
- mode: "checkbox",
235
- },
236
- selected: false
237
- }
238
-
239
- }
240
- },
241
- computed: {
242
-
243
- //表格显示单元行数
244
- show_rows(){
245
- if(!this.collapse) return this.tbody.length;
246
- return this.toggle_tag.selected? this.tbody.length: this.collapse.rows;
247
- }
248
-
249
- },
250
- methods: {
251
-
252
- //开启单元行选择模式
253
- enable_row_select(){
254
- this.checkbox_td_state = true;
255
- },
256
-
257
- //关闭单元行选择模式
258
- disable_row_select(){
259
- this.checkbox_td_state = false;
260
- },
261
-
262
- //开启单元行点击模式
263
- enable_row_click(){
264
- this.hover_tr_color = this.colors.row.hover;
265
- },
266
-
267
- //关闭单元行点击模式
268
- disable_row_click(){
269
- this.hover_tr_color = "";
270
- },
271
-
272
- //处理单元行标题文本
273
- $_format_tr_title(text){
274
- return text.split("").join("<br>");
275
- },
276
-
277
- //单元行点击效果
278
- $_click(index){
279
- this.$emit("on_click", index);
280
- },
281
-
282
- //设置单元格宽度样式
283
- $_set_td_width(item){
284
- return item.width? `w-${item.width}`: `grow-${item.grow || 1}`
285
- },
286
-
287
- //数据验证
288
- $_check_data(){
289
- if(this.tbody[0]) this.thead.length !== this.tbody[0].length && console.warn("thead & tbody have different length!");
290
- }
291
-
292
- },
293
- watch: {
294
-
295
- //监测表格数据
296
- tbody(val){
297
- this.$_check_data();
298
- this.tbody_data = val.map(()=>{
299
- return false;
300
- })
301
- },
302
-
303
- //监测单元行选择
304
- tbody_data(val){
305
- this.$emit("on_select", val.reduce((total, select, i)=>{
306
- select && total.push(i);
307
- return total;
308
- }, []));
309
- },
310
-
311
- //监测全选
312
- select_all_state(state){
313
- let select = state? true: false;
314
- this.tbody_data = this.tbody_data.map(()=>{
315
- return select;
316
- })
317
- }
318
-
319
- },
320
- mounted(){
321
- this.$_check_data();
322
- }
323
- }
324
- </script>
@@ -1,183 +0,0 @@
1
- <template>
2
- <b-hot @on_click="$_click"
3
- @on_move="$emit('on_move', $event)"
4
- @on_enter="$emit('on_enter', $event)"
5
- @on_leave="$emit('on_leave', $event)"
6
- :styles="`pad-h-1.4 pad-v-.4 round-sm mrg-r-.4 mrg-b-.4 line thick-1 line-${tag_colors.normal.line} color-${tag_colors.normal.text} bg-color-${tag_colors.normal.bg}`"
7
- :states="{
8
- act: {
9
- style: `line thick-1 line-${tag_colors.act.line} bg-color-${tag_colors.act.bg} color-${tag_colors.act.text}`,
10
- state: selected
11
- }
12
- }"
13
- :hover="`line thick-1 line-${tag_colors.hover.line} bg-color-${tag_colors.hover.bg} color-${tag_colors.hover.text}`">
14
- <b-text styles="scale-.9"
15
- :states="{
16
- act: {
17
- style: 'scale-1',
18
- state: selected
19
- }
20
- }"
21
- v-html="tag_text" />
22
- </b-hot>
23
- </template>
24
-
25
- <script>
26
- import BHot from "@/components/BTXUI/core/b-hot"
27
- import BText from "@/components/BTXUI/core/b-text"
28
-
29
- let desc = ["该组件用于进行标签选择,分为 “单选” 和 “复选” 两种方式。“单选(once)” 仅限一次性点击,不可通过点击撤回;“复选(toggle)” 则可以反复进行点击切换。"],
30
- extend = [],
31
- dependent = ["b-hot"],
32
- api = {
33
- event: [
34
- {
35
- name: "on_click",
36
- ef: "点击触发",
37
- params: "id, selected, event"
38
- },
39
- {
40
- name: "on_enter",
41
- ef: "鼠标移入或手指按下(悬停)",
42
- params: "event"
43
- },
44
- {
45
- name: "on_leave",
46
- ef: "鼠标移出或手指抬起",
47
- params: "event"
48
- },
49
- {
50
- name: "on_move",
51
- ef: "鼠标移动",
52
- params: "event"
53
- }
54
- ]
55
- },
56
- init_data = `{
57
- id: "标签 id",
58
- text: "标签未选中状态文字(支持富文本)",
59
- selected: "(v-model)选中状态",
60
- /* actText: "标签选中状态文字(支持富文本)" */,
61
- /* colors: {
62
- normal: {
63
- text: "默认文字色样式色值",
64
- bg: "默认背景色样式色值",
65
- line: "默认边框色样式色值",
66
- },
67
- act: {
68
- text: "激活文字色样式色值",
69
- bg: "激活背景色样式色值",
70
- line: "激活边框色样式色值",
71
- },
72
- hover: {
73
- text: "悬停文字色样式色值",
74
- bg: "悬停背景色样式色值",
75
- line: "悬停边框色样式色值",
76
- },
77
- } */,
78
- /* mode: "选择模式(默认"radio":单选、"checkbox":复选)" */,
79
- }`;
80
-
81
- export default {
82
- name: "tag-wid",
83
- introduce: { desc, extend, dependent, api, init_data },
84
- components: {
85
- BHot,
86
- BText
87
- },
88
- model:{
89
- prop: "selected",
90
- event: "on_select"
91
- },
92
- props: {
93
- id: {
94
- type: [String, Number],
95
- required: true
96
- },
97
- text: {
98
- type: String,
99
- required: true
100
- },
101
- selected: {
102
- type: [Boolean, Number],
103
- required: false
104
- },
105
- actText: {
106
- type: String,
107
- required: false
108
- },
109
- colors: {
110
- type: Object,
111
- required: false,
112
- default: () => {
113
- return {
114
- normal:{},
115
- hover:{},
116
- act:{},
117
- }
118
- }
119
- },
120
- mode: {
121
- type: String,
122
- required: false,
123
- default: "radio"
124
- }
125
- },
126
- data(){
127
- return {
128
-
129
- //色彩方案
130
- tag_colors: {
131
- normal: {
132
- text: "dgray",
133
- bg: "light",
134
- line: "none",
135
- ...this.colors.normal
136
- },
137
- hover: {
138
- text: "blue",
139
- bg: "light",
140
- line: "none",
141
- ...this.colors.hover
142
- },
143
- act: {
144
- text: "light",
145
- bg: "blue",
146
- line: "none",
147
- ...this.colors.act
148
- },
149
- },
150
-
151
- //参数类型
152
- data_type: typeof(this.selected)
153
-
154
- }
155
- },
156
- computed: {
157
-
158
- //标签文字
159
- tag_text(){
160
- return this.selected? (this.actText? this.actText: this.text): this.text;
161
- }
162
-
163
- },
164
- methods: {
165
-
166
- //点击事件
167
- $_click(e){
168
- let state;
169
- e.stopPropagation();
170
- if(this.mode === "checkbox"){ //复选
171
- state = !this.selected;
172
- }else if(this.mode === "radio"){ //单选
173
- if(this.selected === true) return;
174
- state = true;
175
- }
176
- if(this.data_type === "number") state = state? 1: 0;
177
- this.$emit("on_select", state);
178
- this.$emit("on_click", this.id, state, e);
179
- }
180
-
181
- }
182
- }
183
- </script>
@@ -1,121 +0,0 @@
1
- <template>
2
- <b-view :styles="column? 'flex-column': 'flex'">
3
- <tag-wid v-for="item of tag_list" :key="item.id"
4
- @on_click="$_click"
5
- :id="item.id"
6
- :text="item.text"
7
- v-bind="tag_data"
8
- v-model="item.selected" />
9
- </b-view>
10
- </template>
11
-
12
- <script>
13
- import BView from "@/components/BTXUI/core/b-view"
14
- import TagWid from "@/components/BTXUI/tag/tag-wid"
15
-
16
- let desc = ["该组件用于进行单选及复选操作。"],
17
- extend = [],
18
- dependent = ["tag-wid", "b-view"],
19
- api = {
20
- event: [
21
- {
22
- name: "on_click",
23
- ef: "点击触发",
24
- params: "selected"
25
- }
26
- ]
27
- },
28
- init_data = `{
29
- value: "(v-model)当前标签 id 列表",
30
- tagList: "[
31
- {
32
- id: "标签 id",
33
- text: "标签文字",
34
- },...
35
- ]",
36
- /* colors: "(参照:tag-wid 组件 colors 参数)" */,
37
- /* mode: "(参照:tag-wid 组件 mode 参数)" */,
38
- /* column: "纵向排列,默认 false" */,
39
- }`;
40
-
41
- export default {
42
- name: "tags-wid",
43
- introduce: { desc, extend, dependent, api, init_data },
44
- components: {
45
- BView,
46
- TagWid
47
- },
48
- model:{
49
- prop: "value",
50
- event: "on_select"
51
- },
52
- props: {
53
- value: {
54
- type: Array,
55
- required: true
56
- },
57
- tagList: {
58
- type: Array,
59
- required: true
60
- },
61
- colors: {
62
- type: Object,
63
- required: false,
64
- default: () => {
65
- return {
66
- normal:{},
67
- hover:{},
68
- act:{},
69
- }
70
- }
71
- },
72
- mode: {
73
- type: String,
74
- required: false,
75
- default: "radio"
76
- },
77
- column: {
78
- type: Boolean,
79
- required: false
80
- },
81
- },
82
- data(){
83
- return {
84
-
85
- //标签数据
86
- tag_data: {
87
- colors: this.colors,
88
- mode: this.mode
89
- }
90
-
91
- }
92
- },
93
- computed: {
94
-
95
- //标签数据列表
96
- tag_list(){
97
- return this.tagList.map(item=>{
98
- return {
99
- ...item,
100
- selected: this.value.includes(item.id)
101
- };
102
- })
103
- }
104
-
105
- },
106
- methods: {
107
-
108
- //点击事件
109
- $_click(id){
110
- if(this.mode === "checkbox"){ //多选
111
- let index = this.value.indexOf(id);
112
- index === -1? this.value.push(id): this.value.splice(index, 1);
113
- }else if(this.mode === "radio"){ //单选
114
- this.$emit("on_select", [id]);
115
- }
116
- this.$emit("on_click", this.value);
117
- },
118
-
119
- }
120
- }
121
- </script>