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,444 +0,0 @@
1
- <template>
2
- <b-view :styles="`rel h-${view.height} bg-color-${view.bg_color}`"
3
- @on_enter="stop_auto_play"
4
- @on_leave="auto_play_data.enable && auto_play()">
5
-
6
- <!--轮播内容-->
7
- <b-view :styles="`rel no-scroll h-${view.height}`">
8
- <b-view ref="sliderBar"
9
- :styles="`flex touch-none h-${view.height}`"
10
- :dynamic="`w-${slider_bar_width}px translateX-${this.touch_point.x.toString().replace('-', 'f')}px ${this.flip_ani? 'trans-fast': 'trans-no'}`"
11
- @on_touchstart="$_touch_start"
12
- @on_touchmove="$_touch_move"
13
- @on_touchend="$_touch_end"
14
- @on_transitionend="$_flip_over">
15
- <b-list v-for="page of slider_pages" :key="page.id"
16
- styles="grow-1"
17
- :go-top-btn="goTopBtn"
18
- :state="page.state">
19
- <slot :name="page.id"></slot>
20
- </b-list>
21
- </b-view>
22
- </b-view>
23
-
24
- <!--计数点-->
25
- <b-view :styles="`flex-5 abs z1 max-w h-0 b-${showDot.bottom}`" v-if="showDot">
26
- <b-hot v-for="(page,index) of slider_pages" :key="index"
27
- :styles="`round mrg-h-.5 w-.5 h-.5 bg-color-${showDot.color}`"
28
- :states="{
29
- act: {
30
- style: `bg-color-${showDot.act_color}`,
31
- state: page.state === 'act'
32
- }
33
- }"
34
- @on_click="$_dot_click(index + 1)"
35
- :data-s="page.state"
36
- :data-page="index + 1">
37
- </b-hot>
38
- </b-view>
39
-
40
- <!--切换按钮-->
41
- <template v-if="show_flip_btn" >
42
- <b-hot styles="round bg-color-neutral translateY-f50 flex-5 abs t-50% l-1 w-4 h-4 fsize-2"
43
- hover="bg-color-rgba(255,255,255,.4)"
44
- @on_click="prev">
45
- <b-icon icon="arrow-left" />
46
- </b-hot>
47
- <b-hot styles="round bg-color-neutral translateY-f50 flex-5 abs t-50% r-1 w-4 h-4 fsize-2"
48
- hover="bg-color-rgba(255,255,255,.4)"
49
- @on_click="next">
50
- <b-icon icon="arrow-right" />
51
- </b-hot>
52
- </template>
53
-
54
- </b-view>
55
- </template>
56
-
57
- <script>
58
- import BView from "@/components/BTXUI/core/b-view"
59
- import BHot from "@/components/BTXUI/core/b-hot"
60
- import BIcon from "@/components/BTXUI/core/b-icon"
61
- import BList from "@/components/BTXUI/core/b-list"
62
-
63
- const desc = ["该组件用于设置内容轮播,支持页面 resize 时自动校正尺寸。",{
64
- cover: "slider-wid.png",
65
- title: "轮播执行机制原理"
66
- }],
67
- extend = [],
68
- dependent = ["b-list", "b-hot", "b-icon", "b-view"],
69
- api = {
70
- event: [
71
- {
72
- name: "on_flip",
73
- ef: "分页完成",
74
- params: "cur_page"
75
- },
76
- {
77
- name: "on_load",
78
- ef: "分页结构生成",
79
- params: "-"
80
- }
81
- ],
82
- methods: [
83
- {
84
- name: "prev",
85
- ef: "向前翻页",
86
- params: "flip_ani",
87
- return: "-"
88
- },
89
- {
90
- name: "next",
91
- ef: "向后翻页",
92
- params: "flip_ani",
93
- return: "-"
94
- },
95
- {
96
- name: "flip",
97
- ef: "翻页",
98
- params: "page, flip_ani",
99
- return: "-"
100
- },
101
- {
102
- name: "auto_play",
103
- ef: "自动播放",
104
- params: "restart",
105
- return: "-"
106
- },
107
- {
108
- name: "stop_auto_play",
109
- ef: "停止自动播放",
110
- params: "-",
111
- return: "-"
112
- },
113
- {
114
- name: "forbid_touch",
115
- ef: "禁止触控滑动",
116
- params: "if_forbid",
117
- return: "-"
118
- }
119
- ]
120
- },
121
- init_data = `{
122
- pages: [
123
- {
124
- id: "内容标识"
125
- },...
126
- ],
127
- /* view: {
128
- height: "轮播器高度(默认为 auto,由内容撑起)",
129
- bg_color: "轮播器背景色(默认为透明)"
130
- } */,
131
- /* showDot: {
132
- bottom: "底边位移",
133
- color: "点颜色",
134
- act_color: "点激活颜色"
135
- } */,
136
- /* showFlipBtn: "显示切换按钮" */,
137
- /* autoPlayDuration: "自动播放时间间隔(毫秒)" */,
138
- /* loop: "是否循环播放" */,
139
- /* keyboardFlip: "是否启用键盘切换" */,
140
- /* goTopBtn: "(参照:b-list 组件 goTopBtn 入参)" */
141
- }`;
142
-
143
- export default {
144
- name: "slider-wid",
145
- introduce: { desc, extend, dependent, api, init_data },
146
- components: {
147
- BHot,
148
- BIcon,
149
- BView,
150
- BList
151
- },
152
- props: {
153
- pages: {
154
- type: Array,
155
- required: true
156
- },
157
- view: {
158
- type: Object,
159
- required: false,
160
- default: ()=>{
161
- return {
162
- height: "auto",
163
- bg_color: "none"
164
- }
165
- }
166
- },
167
- showDot: {
168
- type: Object,
169
- required: false
170
- },
171
- showFlipBtn: {
172
- type: Boolean,
173
- required: false
174
- },
175
- autoPlayDuration: {
176
- type: Number,
177
- required: false
178
- },
179
- loop: {
180
- type: Boolean,
181
- required: false
182
- },
183
- keyboardFlip: {
184
- type: Boolean,
185
- required: false
186
- },
187
- goTopBtn: {
188
- type: Object,
189
- required: false
190
- }
191
- },
192
- data(){
193
- return {
194
-
195
- //数据分页
196
- slider_pages: [],
197
-
198
- //滑动条宽度
199
- slider_bar_width: 0,
200
-
201
- //索引指针
202
- point: {
203
- prev: 0,
204
- cur: 0,
205
- },
206
-
207
- //是否自动播放
208
- auto_play_data: {
209
- enable: false,
210
- interval: 0
211
- },
212
-
213
- //触控点
214
- touch_point: {
215
- start: 0,
216
- left: 0,
217
- x: 0,
218
- threshold: 2,
219
- offset: 0,
220
- direction: {
221
- enable: true,
222
- offset: false,
223
- dir: null
224
- }
225
- },
226
-
227
- //翻页缓动
228
- flip_ani: true,
229
-
230
- //滑动启用状态
231
- touch_move_enable: true,
232
-
233
- //是否显示翻页按钮
234
- show_flip_btn: false
235
-
236
- }
237
- },
238
- computed: {
239
-
240
- //轮播容器
241
- slider_bar(){
242
- return this.$refs.sliderBar;
243
- }
244
-
245
- },
246
- methods: {
247
-
248
- //向前翻页
249
- prev(flip_ani){
250
- this.flip(this.point.cur, flip_ani);
251
- },
252
-
253
- //向后翻页
254
- next(flip_ani){
255
- this.flip(this.point.cur + 2, flip_ani);
256
- },
257
-
258
- //翻页
259
- flip(page, flip_ani=true){
260
- let page_len = this.slider_pages.length;
261
-
262
- //设置播放模式(point:索引,page:页码)
263
- if(this.loop){//循环
264
- if(page < 1){
265
- this.point.cur = page_len - 1;
266
- }else if(page > page_len){
267
- this.point.cur = 0;
268
- }else{
269
- this.point.cur = page - 1;
270
- }
271
- }else{//定向
272
- this.point.cur = Math.min(page_len - 1, Math.max(0, page - 1));
273
- }
274
- this.touch_point.x = this.touch_point.left = -this.point.cur * this.$el.clientWidth; //位移
275
-
276
- //设置分页激活状态
277
- if(this.point.prev !== this.point.cur){
278
- let cur_page_data = this.slider_pages[this.point.cur];
279
- this.slider_pages[this.point.prev].state = "";
280
- cur_page_data.state = "act";
281
- this.point.prev = this.point.cur;
282
- }
283
-
284
- //设置分页缓动
285
- !flip_ani && this.$emit("on_flip", this.point.cur + 1);
286
- this.flip_ani = flip_ani;
287
- },
288
-
289
- //自动播放
290
- auto_play(restart){
291
- this.auto_play_data.interval = setInterval(()=>{
292
- restart? this.flip(1): this.next(true);
293
- }, this.auto_play_data.duration)
294
- },
295
-
296
- //停止自动播放
297
- stop_auto_play(){
298
- clearInterval(this.auto_play_data.interval);
299
- },
300
-
301
- //禁止触控滑动
302
- forbid_touch(if_forbid){
303
- this.touch_move_enable = if_forbid === true? false: true;
304
- },
305
-
306
- //初始化组件数据
307
- $_init_data(){
308
- this.point = {
309
- prev: 0,
310
- cur: 0
311
- };
312
- this.show_flip_btn = this.showFlipBtn;
313
- this.slider_pages = this.pages.map((data, i) => {
314
- return {
315
- id: data.id,
316
- state: i==0?"act":""
317
- };
318
- })
319
- this.$_set_slider_bar_width();
320
- this.$_init_auto_play();
321
- if(this.keyboardFlip) this.$_bind_keyboard_flip_event();
322
-
323
- //分页结构生成
324
- this.$nextTick(()=>{
325
- this.$emit("on_load");
326
- })
327
-
328
- },
329
-
330
- //初始化自动播放
331
- $_init_auto_play(){
332
- let duration = this.autoPlayDuration;
333
- if(duration){
334
- this.auto_play_data = {
335
- enable: true,
336
- duration: duration,
337
- interval: null,
338
- };
339
- this.auto_play();
340
- }
341
- },
342
-
343
- //触控开始手势
344
- $_touch_start(e){
345
- this.touch_point.start = e.touches[0].pageX;
346
- this.touch_point.direction.enable = true;
347
- this.flip_ani = false;
348
- this.stop_auto_play();
349
- },
350
-
351
- //触控结束手势
352
- $_touch_end(){
353
- this.$_flip_as_threshold();
354
- this.auto_play_data.enable && this.auto_play()
355
- },
356
-
357
- //触控滑动手势
358
- $_touch_move(e){
359
- if(this.touch_move_enable){
360
- let touch = e.touches[0],
361
- touch_point = this.touch_point,
362
- offset;
363
- this.$_flip_direction(touch, touch_point);
364
- if(touch_point.direction.dir === "horizontal"){
365
- touch_point.offset = offset = touch.pageX - touch_point.start;
366
- e.cancelable && e.preventDefault();
367
- touch_point.x = touch_point.left + offset;
368
- }
369
- }
370
- },
371
-
372
- //触控分页阈值处理
373
- $_flip_as_threshold(){
374
- let touch_point = this.touch_point;
375
- if(touch_point.offset !== 0){ //无位移,不执行
376
- let flip = Math.abs(touch_point.x / this.$el.clientWidth),
377
- flip_dir = touch_point.x < touch_point.left? "left": "right",
378
- page = this.point.cur + 1,
379
- overflow_x = flip.toString().split(".")[1][0];
380
- if(flip_dir === "right" && overflow_x < 10 - touch_point.threshold){//向右滑动:上一页
381
- page--;
382
- }else if(flip_dir === "left" && overflow_x >= touch_point.threshold){//向左滑动:下一页
383
- page++;
384
- }
385
- this.flip(page, true);
386
- touch_point.offset = 0;
387
- }
388
- },
389
-
390
- //滑动结束
391
- $_flip_over(){
392
- this.$emit("on_flip", this.point.cur + 1);
393
- },
394
-
395
- //滑动方向判断
396
- $_flip_direction(touch, touch_point){
397
- let direction = touch_point.direction;
398
- if(direction.enable){
399
- if(direction.offset){ //方向判断
400
- let offset_x = Math.abs(touch.pageX - direction.x),
401
- offset_y = Math.abs(touch.pageY - direction.y);
402
- direction.dir = offset_x >= offset_y? "horizontal": "vertical";
403
- direction.offset = direction.enable = false;
404
- }else{ //定位起始坐标
405
- direction.x = touch.pageX;
406
- direction.y = touch.pageY;
407
- direction.offset = true;
408
- }
409
- }
410
- },
411
-
412
- //计数点点击
413
- $_dot_click(page){
414
- this.flip(page, true);
415
- },
416
-
417
- //绑定键盘翻页事件
418
- $_bind_keyboard_flip_event(){
419
- window.addEventListener("keyup", (e) => {
420
- if(e.key === "ArrowLeft") this.prev(".54s");
421
- if(e.key === "ArrowRight") this.next(".54s");
422
- });
423
- },
424
-
425
- //设置 slider_bar 宽度
426
- $_set_slider_bar_width(){
427
- this.slider_bar_width = this.slider_pages.length * this.$el.clientWidth;
428
- }
429
-
430
- },
431
- watch: {
432
- pages(){
433
- this.$_init_data();
434
- }
435
- },
436
- mounted(){
437
- this.$_init_data();
438
- window.addEventListener("resize", this.$_set_slider_bar_width)
439
- },
440
- destroyed(){
441
- window.removeEventListener("resize", this.$_set_slider_bar_width);
442
- }
443
- }
444
- </script>
@@ -1,109 +0,0 @@
1
- <template>
2
- <b-view>
3
- <b-view styles="rel t-2px">
4
- <tags-wid v-bind="tags_data" v-model="cur_tab"/>
5
- </b-view>
6
- <b-view styles="rel">
7
- <slider-wid :pages="tags_data.tagList" ref="slider"
8
- @on_flip="$_page_flip"
9
- @on_load="$_init_page">
10
- <slot v-for="page of tags_data.tagList"
11
- :slot="page.id"
12
- :name="page.id" />
13
- </slider-wid>
14
- </b-view>
15
- </b-view>
16
- </template>
17
-
18
- <script>
19
- import BView from "@/components/BTXUI/core/b-view"
20
- import BText from "@/components/BTXUI/core/b-text"
21
- import TagsWid from "@/components/BTXUI/tags/tags-wid"
22
- import SliderWid from "@/components/BTXUI/slider/slider-wid"
23
-
24
- let desc = ["该组件用于进行标签切换交互操作。"],
25
- extend = [],
26
- dependent = ["slider-wid", "tags-wid", "b-text", "b-view"],
27
- api = null,
28
- init_data = `{
29
- curTab: "(v-model)当前 tag id",
30
- tagsData: "(参照:tags-wid 组件入参,不含 mode 项)",
31
- /* smooth: "平滑切换,默认 false" */,
32
- }`;
33
-
34
- export default {
35
- name: "tab-wid",
36
- introduce: { desc, extend, dependent, api, init_data },
37
- components: {
38
- BView,
39
- BText,
40
- TagsWid,
41
- SliderWid
42
- },
43
- model:{
44
- prop: "curTab",
45
- event: "on_select"
46
- },
47
- props: {
48
- curTab: {
49
- type: String,
50
- required: true
51
- },
52
- tagsData: {
53
- type: Object,
54
- required: true
55
- },
56
- smooth: {
57
- type: Boolean,
58
- required: false,
59
- default: false
60
- }
61
- },
62
- data(){
63
- return {
64
-
65
- //当前所选标签
66
- cur_tab: [this.curTab],
67
-
68
- //tags_data
69
- tags_data: { ...this.tagsData, mode: "radio" }
70
-
71
- }
72
- },
73
- computed: {
74
-
75
- //轮播器
76
- slider(){
77
- return this.$refs.slider;
78
- }
79
-
80
- },
81
- watch: {
82
-
83
- //监听当前所选标签
84
- cur_tab(val){
85
- this.slider.flip(this.tags_data.tagList.findIndex((item)=>{
86
- return item.id === val[0]
87
- }) + 1, this.smooth);
88
- this.$emit("on_select", val[0]);
89
- }
90
-
91
- },
92
- methods: {
93
-
94
- //初始化内容定位
95
- $_init_page(){
96
- this.slider.flip(this.tags_data.tagList.findIndex((item)=>{
97
- return item.id === this.cur_tab[0]
98
- }) + 1, false);
99
- },
100
-
101
- //触控分页
102
- $_page_flip(page){
103
- const val = this.tagsData.tagList[page - 1].id;
104
- if(this.cur_tab[0] !== val) this.cur_tab = [val];
105
- }
106
-
107
- }
108
- }
109
- </script>