btxui 1.0.2 → 1.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.
- package/demo.html +1 -0
- package/index.common.js +93 -0
- package/index.common.js.map +1 -0
- package/index.umd.js +104 -0
- package/index.umd.js.map +1 -0
- package/index.umd.min.js +2 -0
- package/index.umd.min.js.map +1 -0
- package/package.json +12 -23
- package/README.md +0 -42
- package/app.vue +0 -162
- package/assets/css/_main.js +0 -73
- package/assets/css/btx.min.css +0 -1
- package/assets/css/btx.mob.min.css +0 -1
- package/assets/css/btx.pad.min.css +0 -1
- package/assets/css/btx.webapp.min.css +0 -1
- package/assets/css/custom_fonts/iconfont.css +0 -37
- package/assets/css/custom_fonts/iconfont.eot +0 -0
- package/assets/css/custom_fonts/iconfont.svg +0 -47
- package/assets/css/custom_fonts/iconfont.ttf +0 -0
- package/assets/css/custom_fonts/iconfont.woff +0 -0
- package/assets/css/custom_fonts/iconfont.woff2 +0 -0
- package/assets/css/res-l.css +0 -47
- package/assets/css/res-m.css +0 -47
- package/assets/css/res-s.css +0 -61
- package/assets/custom_fonts/iconfont.css +0 -37
- package/assets/custom_fonts/iconfont.eot +0 -0
- package/assets/custom_fonts/iconfont.svg +0 -47
- package/assets/custom_fonts/iconfont.ttf +0 -0
- package/assets/custom_fonts/iconfont.woff +0 -0
- package/assets/custom_fonts/iconfont.woff2 +0 -0
- package/assets/js/Btx.js +0 -196
- package/assets/js/Utils.js +0 -421
- package/assets/js/fastclick.js +0 -802
- package/assets/js/lazy.min.js +0 -2
- package/assets/js/touchwipe.js +0 -111
- package/assets/server.js +0 -8
- package/assets/start_site_code_str.js +0 -119
- package/cdn/css/btx.min.css +0 -1
- package/cdn/css/btx.min.css.map +0 -1
- package/cdn/fonts/iconfont.ttf +0 -0
- package/cdn/fonts/iconfont.woff +0 -0
- package/cdn/fonts/iconfont.woff2 +0 -0
- package/components/BTXUI/app/app-wid.vue +0 -182
- package/components/BTXUI/btn/btn-wid.vue +0 -128
- package/components/BTXUI/carousel/carousel-wid.vue +0 -138
- package/components/BTXUI/checkbox/checkbox-wid.vue +0 -72
- package/components/BTXUI/confirm/confirm-wid.vue +0 -279
- package/components/BTXUI/content/content-checkbox-wid.vue +0 -44
- package/components/BTXUI/content/content-node-wid.vue +0 -114
- package/components/BTXUI/content/content-tag-wid.vue +0 -25
- package/components/BTXUI/content/content-wid.vue +0 -254
- package/components/BTXUI/core/anis/ani-fail.vue +0 -46
- package/components/BTXUI/core/anis/ani-loading.vue +0 -32
- package/components/BTXUI/core/anis/ani-notic.vue +0 -47
- package/components/BTXUI/core/anis/ani-success.vue +0 -48
- package/components/BTXUI/core/b-drag.vue +0 -258
- package/components/BTXUI/core/b-grid.vue +0 -84
- package/components/BTXUI/core/b-hot.vue +0 -171
- package/components/BTXUI/core/b-icon.vue +0 -76
- package/components/BTXUI/core/b-img.vue +0 -84
- package/components/BTXUI/core/b-input.vue +0 -198
- package/components/BTXUI/core/b-list.vue +0 -276
- package/components/BTXUI/core/b-text/doc.ts +0 -9
- package/components/BTXUI/core/b-text/index.vue +0 -16
- package/components/BTXUI/core/b-textarea.vue +0 -58
- package/components/BTXUI/core/b-video.vue +0 -35
- package/components/BTXUI/core/b-view/doc.ts +0 -10
- package/components/BTXUI/core/b-view/index.vue +0 -20
- package/components/BTXUI/core/b-webview.vue +0 -20
- package/components/BTXUI/core/lib/ChapterLink.js +0 -49
- package/components/BTXUI/core/lib/Search.vue +0 -60
- package/components/BTXUI/core/styles/doc.ts +0 -55
- package/components/BTXUI/core/styles/index.vue +0 -98
- package/components/BTXUI/core/styles/prestyles.ts +0 -471
- package/components/BTXUI/core/styles/theme.ts +0 -29
- package/components/BTXUI/drawer/drawer-wid.vue +0 -165
- package/components/BTXUI/drawer/title-tag-wid.vue +0 -114
- package/components/BTXUI/form/form-select-wid.vue +0 -57
- package/components/BTXUI/form/form-wid.vue +0 -324
- package/components/BTXUI/formPannel/form-pannel-wid.vue +0 -133
- package/components/BTXUI/imgsUpload/imgs-upload-wid.vue +0 -149
- package/components/BTXUI/index.js +0 -83
- package/components/BTXUI/pageFlip/page-flip-wid.vue +0 -206
- package/components/BTXUI/pannel/pannel-wid.vue +0 -167
- package/components/BTXUI/range/range-wid.vue +0 -134
- package/components/BTXUI/search/search-wid.vue +0 -80
- package/components/BTXUI/select/select-wid.vue +0 -186
- package/components/BTXUI/slider/slider-wid.vue +0 -444
- package/components/BTXUI/tab/tab-wid.vue +0 -109
- package/components/BTXUI/table/table-wid.vue +0 -324
- package/components/BTXUI/tag/tag-wid.vue +0 -183
- package/components/BTXUI/tags/tags-wid.vue +0 -121
- package/components/BTXUI/tooltip/tooltip-wid.vue +0 -146
- package/components/BTXUI/upload/upload-wid.vue +0 -215
- package/components/BTXUI/waterfall/waterfall-wid.vue +0 -166
- package/components/header-info.vue +0 -167
- package/composables/@types.ts +0 -4
- package/composables/api.ts +0 -18
- package/env.d.ts +0 -5
- package/main.js +0 -16
- package/nuxt.config.ts +0 -51
- package/pages/article.vue +0 -16
- package/pages/download.vue +0 -50
- package/pages/example/app_wid/app/data_demo.vue +0 -9
- package/pages/example/app_wid/app/download_demo.vue +0 -9
- package/pages/example/app_wid/app/list_demo.vue +0 -11
- package/pages/example/app_wid/app/system_demo.vue +0 -9
- package/pages/example/app_wid/app_wid_demo.vue +0 -198
- package/pages/example/app_wid/btn_wid_demo.vue +0 -179
- package/pages/example/app_wid/carousel_wid_demo.vue +0 -152
- package/pages/example/app_wid/checkbox_wid_demo.vue +0 -65
- package/pages/example/app_wid/confirm_wid_demo.vue +0 -197
- package/pages/example/app_wid/content_wid_demo.vue +0 -369
- package/pages/example/app_wid/drawer_wid_demo.vue +0 -155
- package/pages/example/app_wid/form_pannel_wid_demo.vue +0 -338
- package/pages/example/app_wid/form_wid_demo.vue +0 -550
- package/pages/example/app_wid/imgs_upload_wid_demo.vue +0 -159
- package/pages/example/app_wid/index.js +0 -158
- package/pages/example/app_wid/page_flip_wid_demo.vue +0 -99
- package/pages/example/app_wid/pannel_wid_demo.vue +0 -177
- package/pages/example/app_wid/range_wid_demo.vue +0 -101
- package/pages/example/app_wid/search_wid_demo.vue +0 -75
- package/pages/example/app_wid/select_wid_demo.vue +0 -217
- package/pages/example/app_wid/slider_wid_demo.vue +0 -143
- package/pages/example/app_wid/tab_wid_demo.vue +0 -170
- package/pages/example/app_wid/table_wid_demo.vue +0 -377
- package/pages/example/app_wid/tag_wid_demo.vue +0 -133
- package/pages/example/app_wid/tags_wid_demo.vue +0 -143
- package/pages/example/app_wid/tooltip_wid_demo.vue +0 -117
- package/pages/example/app_wid/upload_wid_demo.vue +0 -123
- package/pages/example/base_wid/b_drag_demo.vue +0 -159
- package/pages/example/base_wid/b_grid_demo.vue +0 -225
- package/pages/example/base_wid/b_hot_demo.vue +0 -135
- package/pages/example/base_wid/b_icon_demo.vue +0 -80
- package/pages/example/base_wid/b_img_demo.vue +0 -95
- package/pages/example/base_wid/b_input_demo.vue +0 -171
- package/pages/example/base_wid/b_list_demo.vue +0 -241
- package/pages/example/base_wid/b_style_demo.vue +0 -928
- package/pages/example/base_wid/b_text_demo.vue +0 -36
- package/pages/example/base_wid/b_textarea_demo.vue +0 -64
- package/pages/example/base_wid/b_video_demo.vue +0 -42
- package/pages/example/base_wid/b_view_demo.vue +0 -36
- package/pages/example/base_wid/index.js +0 -76
- package/pages/example/content.js +0 -49
- package/pages/example/global_style/animation.vue +0 -197
- package/pages/example/global_style/color.vue +0 -134
- package/pages/example/global_style/decoration.vue +0 -546
- package/pages/example/global_style/icon.vue +0 -345
- package/pages/example/global_style/index.js +0 -52
- package/pages/example/global_style/layout.vue +0 -846
- package/pages/example/global_style/special.vue +0 -37
- package/pages/example/global_style/table.vue +0 -298
- package/pages/example/global_style/text.vue +0 -159
- package/pages/index.vue +0 -43
- package/pages/level_widget.vue +0 -11
- package/pages/start.vue +0 -200
- package/plugins/index.ts +0 -2
- package/public/favicon.gif +0 -0
- package/public/fonts/iconfont.ttf +0 -0
- package/public/fonts/iconfont.woff +0 -0
- package/public/fonts/iconfont.woff2 +0 -0
- package/public/img/banner.jpg +0 -0
- package/public/img/banner2.jpg +0 -0
- package/public/img/bg_pattern.png +0 -0
- package/public/img/btx.jpg +0 -0
- package/public/img/btx_ui.jpg +0 -0
- package/public/img/dir.png +0 -0
- package/public/img/f.png +0 -0
- package/public/img/head.jpg +0 -0
- package/public/img/head2.jpg +0 -0
- package/public/img/home_ico.png +0 -0
- package/public/img/icons.svg +0 -164
- package/public/img/mechanism/b-style.png +0 -0
- package/public/img/mechanism/slider-wid.png +0 -0
- package/public/img/mechanism/upload-wid.png +0 -0
- package/public/img/transform_origin.png +0 -0
- package/sass/animation.scss +0 -400
- package/sass/btx.mob.scss +0 -10
- package/sass/btx.pad.scss +0 -3
- package/sass/btx.scss +0 -22
- package/sass/btx.webapp.scss +0 -22
- package/sass/colors.scss +0 -65
- package/sass/decoration.scss +0 -220
- package/sass/flex.scss +0 -29
- package/sass/icons.scss +0 -100
- package/sass/layout.scss +0 -88
- package/sass/reset.scss +0 -111
- package/sass/response/flex_mixin.scss +0 -91
- package/sass/response/layout_mixin.scss +0 -227
- package/sass/response/main.scss +0 -59
- package/sass/response/text_mixin.scss +0 -65
- package/sass/scroll.scss +0 -100
- package/sass/special.scss +0 -13
- package/sass/table.scss +0 -103
- package/sass/text.scss +0 -86
- package/sass/webpack.config.js +0 -31
- 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>
|