btxui 1.0.1
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/README.md +42 -0
- package/app.vue +162 -0
- package/assets/css/_main.js +73 -0
- package/assets/css/btx.min.css +1 -0
- package/assets/css/btx.mob.min.css +1 -0
- package/assets/css/btx.pad.min.css +1 -0
- package/assets/css/btx.webapp.min.css +1 -0
- package/assets/css/custom_fonts/iconfont.css +37 -0
- package/assets/css/custom_fonts/iconfont.eot +0 -0
- package/assets/css/custom_fonts/iconfont.svg +47 -0
- 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 +47 -0
- package/assets/css/res-m.css +47 -0
- package/assets/css/res-s.css +61 -0
- package/assets/custom_fonts/iconfont.css +37 -0
- package/assets/custom_fonts/iconfont.eot +0 -0
- package/assets/custom_fonts/iconfont.svg +47 -0
- 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 +196 -0
- package/assets/js/Utils.js +421 -0
- package/assets/js/fastclick.js +802 -0
- package/assets/js/lazy.min.js +2 -0
- package/assets/js/touchwipe.js +111 -0
- package/assets/server.js +8 -0
- package/assets/start_site_code_str.js +119 -0
- package/cdn/css/btx.min.css +1 -0
- package/cdn/css/btx.min.css.map +1 -0
- 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 +182 -0
- package/components/BTXUI/btn/btn-wid.vue +128 -0
- package/components/BTXUI/carousel/carousel-wid.vue +138 -0
- package/components/BTXUI/checkbox/checkbox-wid.vue +72 -0
- package/components/BTXUI/confirm/confirm-wid.vue +279 -0
- package/components/BTXUI/content/content-checkbox-wid.vue +44 -0
- package/components/BTXUI/content/content-node-wid.vue +114 -0
- package/components/BTXUI/content/content-tag-wid.vue +25 -0
- package/components/BTXUI/content/content-wid.vue +254 -0
- package/components/BTXUI/core/anis/ani-fail.vue +46 -0
- package/components/BTXUI/core/anis/ani-loading.vue +32 -0
- package/components/BTXUI/core/anis/ani-notic.vue +47 -0
- package/components/BTXUI/core/anis/ani-success.vue +48 -0
- package/components/BTXUI/core/b-drag.vue +258 -0
- package/components/BTXUI/core/b-grid.vue +84 -0
- package/components/BTXUI/core/b-hot.vue +171 -0
- package/components/BTXUI/core/b-icon.vue +76 -0
- package/components/BTXUI/core/b-img.vue +84 -0
- package/components/BTXUI/core/b-input.vue +198 -0
- package/components/BTXUI/core/b-list.vue +276 -0
- package/components/BTXUI/core/b-text/doc.ts +9 -0
- package/components/BTXUI/core/b-text/index.vue +16 -0
- package/components/BTXUI/core/b-textarea.vue +58 -0
- package/components/BTXUI/core/b-video.vue +35 -0
- package/components/BTXUI/core/b-view/doc.ts +10 -0
- package/components/BTXUI/core/b-view/index.vue +20 -0
- package/components/BTXUI/core/b-webview.vue +20 -0
- package/components/BTXUI/core/lib/ChapterLink.js +49 -0
- package/components/BTXUI/core/lib/Search.vue +60 -0
- package/components/BTXUI/core/styles/doc.ts +55 -0
- package/components/BTXUI/core/styles/index.vue +98 -0
- package/components/BTXUI/core/styles/prestyles.ts +471 -0
- package/components/BTXUI/core/styles/theme.ts +29 -0
- package/components/BTXUI/drawer/drawer-wid.vue +165 -0
- package/components/BTXUI/drawer/title-tag-wid.vue +114 -0
- package/components/BTXUI/form/form-select-wid.vue +57 -0
- package/components/BTXUI/form/form-wid.vue +324 -0
- package/components/BTXUI/formPannel/form-pannel-wid.vue +133 -0
- package/components/BTXUI/imgsUpload/imgs-upload-wid.vue +149 -0
- package/components/BTXUI/index.js +83 -0
- package/components/BTXUI/pageFlip/page-flip-wid.vue +206 -0
- package/components/BTXUI/pannel/pannel-wid.vue +167 -0
- package/components/BTXUI/range/range-wid.vue +134 -0
- package/components/BTXUI/search/search-wid.vue +80 -0
- package/components/BTXUI/select/select-wid.vue +186 -0
- package/components/BTXUI/slider/slider-wid.vue +444 -0
- package/components/BTXUI/tab/tab-wid.vue +109 -0
- package/components/BTXUI/table/table-wid.vue +324 -0
- package/components/BTXUI/tag/tag-wid.vue +183 -0
- package/components/BTXUI/tags/tags-wid.vue +121 -0
- package/components/BTXUI/tooltip/tooltip-wid.vue +146 -0
- package/components/BTXUI/upload/upload-wid.vue +215 -0
- package/components/BTXUI/waterfall/waterfall-wid.vue +166 -0
- package/components/header-info.vue +167 -0
- package/composables/@types.ts +4 -0
- package/composables/api.ts +18 -0
- package/env.d.ts +5 -0
- package/main.js +6 -0
- package/nuxt.config.ts +51 -0
- package/package.json +23 -0
- package/pages/article.vue +16 -0
- package/pages/download.vue +50 -0
- package/pages/example/app_wid/app/data_demo.vue +9 -0
- package/pages/example/app_wid/app/download_demo.vue +9 -0
- package/pages/example/app_wid/app/list_demo.vue +11 -0
- package/pages/example/app_wid/app/system_demo.vue +9 -0
- package/pages/example/app_wid/app_wid_demo.vue +198 -0
- package/pages/example/app_wid/btn_wid_demo.vue +179 -0
- package/pages/example/app_wid/carousel_wid_demo.vue +152 -0
- package/pages/example/app_wid/checkbox_wid_demo.vue +65 -0
- package/pages/example/app_wid/confirm_wid_demo.vue +197 -0
- package/pages/example/app_wid/content_wid_demo.vue +369 -0
- package/pages/example/app_wid/drawer_wid_demo.vue +155 -0
- package/pages/example/app_wid/form_pannel_wid_demo.vue +338 -0
- package/pages/example/app_wid/form_wid_demo.vue +550 -0
- package/pages/example/app_wid/imgs_upload_wid_demo.vue +159 -0
- package/pages/example/app_wid/index.js +158 -0
- package/pages/example/app_wid/page_flip_wid_demo.vue +99 -0
- package/pages/example/app_wid/pannel_wid_demo.vue +177 -0
- package/pages/example/app_wid/range_wid_demo.vue +101 -0
- package/pages/example/app_wid/search_wid_demo.vue +75 -0
- package/pages/example/app_wid/select_wid_demo.vue +217 -0
- package/pages/example/app_wid/slider_wid_demo.vue +143 -0
- package/pages/example/app_wid/tab_wid_demo.vue +170 -0
- package/pages/example/app_wid/table_wid_demo.vue +377 -0
- package/pages/example/app_wid/tag_wid_demo.vue +133 -0
- package/pages/example/app_wid/tags_wid_demo.vue +143 -0
- package/pages/example/app_wid/tooltip_wid_demo.vue +117 -0
- package/pages/example/app_wid/upload_wid_demo.vue +123 -0
- package/pages/example/base_wid/b_drag_demo.vue +159 -0
- package/pages/example/base_wid/b_grid_demo.vue +225 -0
- package/pages/example/base_wid/b_hot_demo.vue +135 -0
- package/pages/example/base_wid/b_icon_demo.vue +80 -0
- package/pages/example/base_wid/b_img_demo.vue +95 -0
- package/pages/example/base_wid/b_input_demo.vue +171 -0
- package/pages/example/base_wid/b_list_demo.vue +241 -0
- package/pages/example/base_wid/b_style_demo.vue +928 -0
- package/pages/example/base_wid/b_text_demo.vue +36 -0
- package/pages/example/base_wid/b_textarea_demo.vue +64 -0
- package/pages/example/base_wid/b_video_demo.vue +42 -0
- package/pages/example/base_wid/b_view_demo.vue +36 -0
- package/pages/example/base_wid/index.js +76 -0
- package/pages/example/content.js +49 -0
- package/pages/example/global_style/animation.vue +197 -0
- package/pages/example/global_style/color.vue +134 -0
- package/pages/example/global_style/decoration.vue +546 -0
- package/pages/example/global_style/icon.vue +345 -0
- package/pages/example/global_style/index.js +52 -0
- package/pages/example/global_style/layout.vue +846 -0
- package/pages/example/global_style/special.vue +37 -0
- package/pages/example/global_style/table.vue +298 -0
- package/pages/example/global_style/text.vue +159 -0
- package/pages/index.vue +29 -0
- package/pages/level_widget.vue +11 -0
- package/pages/start.vue +200 -0
- package/plugins/index.ts +2 -0
- 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 +164 -0
- 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 +400 -0
- package/sass/btx.mob.scss +10 -0
- package/sass/btx.pad.scss +3 -0
- package/sass/btx.scss +22 -0
- package/sass/btx.webapp.scss +22 -0
- package/sass/colors.scss +65 -0
- package/sass/decoration.scss +220 -0
- package/sass/flex.scss +29 -0
- package/sass/icons.scss +100 -0
- package/sass/layout.scss +88 -0
- package/sass/reset.scss +111 -0
- package/sass/response/flex_mixin.scss +91 -0
- package/sass/response/layout_mixin.scss +227 -0
- package/sass/response/main.scss +59 -0
- package/sass/response/text_mixin.scss +65 -0
- package/sass/scroll.scss +100 -0
- package/sass/special.scss +13 -0
- package/sass/table.scss +103 -0
- package/sass/text.scss +86 -0
- package/sass/webpack.config.js +31 -0
- package/tsconfig.json +4 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<input :style="computed_style" :type="type" :name="name" :readonly="readonly"
|
|
3
|
+
@focus="$_focus"
|
|
4
|
+
@blur="$_blur"
|
|
5
|
+
@change="$_check"
|
|
6
|
+
@keyup.enter="$_enter"
|
|
7
|
+
v-model="value"
|
|
8
|
+
autocomplete="off" />
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
|
|
13
|
+
let desc = ["该组件用于实现输入型表单元素。"],
|
|
14
|
+
extend = ["b-style"],
|
|
15
|
+
dependent = [],
|
|
16
|
+
api = {
|
|
17
|
+
methods: [
|
|
18
|
+
{
|
|
19
|
+
name: "check",
|
|
20
|
+
ef: "表单验证",
|
|
21
|
+
params: "-",
|
|
22
|
+
return: "{name:'表单项属性', notic:'报错提示', pass:'是否通过'}"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
event: [
|
|
26
|
+
{
|
|
27
|
+
name: "on_check",
|
|
28
|
+
ef: "表单输入变化",
|
|
29
|
+
params: "{name:'表单项属性', notic:'报错提示', pass:'是否通过'}",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "on_focus",
|
|
33
|
+
ef: "表单聚焦",
|
|
34
|
+
params: "-",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "on_blur",
|
|
38
|
+
ef: "表单失焦",
|
|
39
|
+
params: "-",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "on_enter",
|
|
43
|
+
ef: "聚焦时键盘按下回车",
|
|
44
|
+
params: "text、event",
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
init_data = `{
|
|
49
|
+
type: "表单元素类型(text:单行文本、password:密码、textarea:多行文本)",
|
|
50
|
+
name: "表单元素数据键名",
|
|
51
|
+
/* styles: "(参照:b-style 组件入参)" */,
|
|
52
|
+
/* inpVal: "(model) 表单输入内容" */,
|
|
53
|
+
/* maxlength: "字符数上限(限输入型表单元素)" */,
|
|
54
|
+
/* placeholder: "输入提示(限输入型表单元素)" */,
|
|
55
|
+
/* readonly: "只读,默认 false" */,
|
|
56
|
+
/* rule: {
|
|
57
|
+
type: "自定义正则验证,或预置正则验证(包括:required、tel、email、url、uname、zh、uid)",
|
|
58
|
+
notic: "验证报错提示"
|
|
59
|
+
} */,
|
|
60
|
+
/* focus: "激活样式值" */,
|
|
61
|
+
}`;
|
|
62
|
+
|
|
63
|
+
export default {
|
|
64
|
+
name: "b-input",
|
|
65
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
66
|
+
model: {
|
|
67
|
+
prop: "inpVal",
|
|
68
|
+
event: "on_input"
|
|
69
|
+
},
|
|
70
|
+
props: {
|
|
71
|
+
type: {
|
|
72
|
+
type: String,
|
|
73
|
+
required: true,
|
|
74
|
+
},
|
|
75
|
+
name: {
|
|
76
|
+
type: String,
|
|
77
|
+
required: true,
|
|
78
|
+
},
|
|
79
|
+
inpVal: {
|
|
80
|
+
type: [String, Number],
|
|
81
|
+
required: false,
|
|
82
|
+
default: ""
|
|
83
|
+
},
|
|
84
|
+
readonly: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
required: false,
|
|
87
|
+
},
|
|
88
|
+
rule: {
|
|
89
|
+
type: Object,
|
|
90
|
+
required: false,
|
|
91
|
+
},
|
|
92
|
+
focus: {
|
|
93
|
+
type: String,
|
|
94
|
+
required: false,
|
|
95
|
+
default: "color-dark bg-color-rgba(134,134,134,.24)"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
data(){
|
|
99
|
+
return {
|
|
100
|
+
|
|
101
|
+
//输入文字
|
|
102
|
+
value: this.inpVal,
|
|
103
|
+
|
|
104
|
+
//预置正则
|
|
105
|
+
preset_rules: {
|
|
106
|
+
required: {
|
|
107
|
+
regexp: /[\w\.\-_\u4e00-\u9fa5]+/,
|
|
108
|
+
notic: "输入内容为空!"
|
|
109
|
+
},
|
|
110
|
+
tel: {
|
|
111
|
+
regexp: /^1[3-9]\d{9}$/,
|
|
112
|
+
notic: "手机号格式有误!"
|
|
113
|
+
},
|
|
114
|
+
email: {
|
|
115
|
+
regexp: /^[\w\.]+@(\w+\.)+(com|net|org|wiki|cn|cc)$/,
|
|
116
|
+
notic: "邮箱格式有误!"
|
|
117
|
+
},
|
|
118
|
+
url: {
|
|
119
|
+
regexp: /^((http|https):\/\/)?(wwww\.)?(\w+\.)+(com|net|org|wiki|cn|cc)$/,
|
|
120
|
+
notic: "url 格式有误!"
|
|
121
|
+
},
|
|
122
|
+
uname: {
|
|
123
|
+
regexp: /^[\w_]+$/,
|
|
124
|
+
notic: "请输入英文字母、数字或下划线!"
|
|
125
|
+
},
|
|
126
|
+
zh: {
|
|
127
|
+
regexp: /^[\u4e00-\u9fa5]+$/,
|
|
128
|
+
notic: "请输入中文字符!"
|
|
129
|
+
},
|
|
130
|
+
uid: {
|
|
131
|
+
regexp: /^\d{15}(\d{2}[0-9x])?$/i,
|
|
132
|
+
notic: "身份证号输入有误!"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
watch: {
|
|
139
|
+
|
|
140
|
+
//监听输入
|
|
141
|
+
inpVal(val){
|
|
142
|
+
this.value = val;
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
//监听输出
|
|
146
|
+
value(val){
|
|
147
|
+
this.$emit("on_input", val? val.trim(): "");
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
},
|
|
151
|
+
methods: {
|
|
152
|
+
|
|
153
|
+
//执行验证
|
|
154
|
+
check(){
|
|
155
|
+
let rule = this.rule;
|
|
156
|
+
if(rule){
|
|
157
|
+
let pre_rule = this.preset_rules[rule.type],
|
|
158
|
+
regexp = pre_rule? pre_rule.regexp: rule.type,
|
|
159
|
+
pre_notic = pre_rule? pre_rule.notic: "输入格式有误!",
|
|
160
|
+
val = this.inpVal;
|
|
161
|
+
return {
|
|
162
|
+
name: this.name,
|
|
163
|
+
notic: rule.notic || pre_notic,
|
|
164
|
+
pass: regexp.test(val)
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
//输入验证
|
|
170
|
+
$_check(){
|
|
171
|
+
this.$emit("on_check", this.check());
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
//表单聚焦
|
|
175
|
+
$_focus(){
|
|
176
|
+
if(this.readonly) return;
|
|
177
|
+
this.toggle_style("focus");
|
|
178
|
+
this.$emit("on_focus");
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
//表单失焦
|
|
182
|
+
$_blur(){
|
|
183
|
+
if(this.readonly) return;
|
|
184
|
+
this.reset_style();
|
|
185
|
+
this.$emit("on_blur");
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
//表单回车
|
|
189
|
+
$_enter(e){
|
|
190
|
+
this.$emit("on_enter", this.inpVal, e);
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
},
|
|
194
|
+
mounted(){
|
|
195
|
+
this.append_state(this.focus, "focus");
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
</script>
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-view :styles="`rel grow-1 max ${styles} over-hide`">
|
|
3
|
+
|
|
4
|
+
<!--置顶按钮-->
|
|
5
|
+
<b-hot :styles="`abs w-3.7 h-3.7 transform-rotate(180deg) z2 round flex-5 line thick-2 line-neutral trans-fast fsize-1.7 r-${go_top_btn.pos.right} b-${go_top_btn.pos.bottom} color-${go_top_btn.colors.normal.icon} bg-color-${go_top_btn.colors.normal.bg}`"
|
|
6
|
+
:hover="`line-none color-${go_top_btn.colors.hover.icon} bg-color-${go_top_btn.colors.hover.bg}`"
|
|
7
|
+
:states="{
|
|
8
|
+
hide: {
|
|
9
|
+
state: top_btn_hide,
|
|
10
|
+
style: 'b-f5'
|
|
11
|
+
}
|
|
12
|
+
}"
|
|
13
|
+
@on_click="reset">
|
|
14
|
+
<b-icon icon="xiala" />
|
|
15
|
+
</b-hot>
|
|
16
|
+
|
|
17
|
+
<!--滚动区域-->
|
|
18
|
+
<b-view styles="max"
|
|
19
|
+
ref="list"
|
|
20
|
+
:states="{
|
|
21
|
+
scroll_x: {
|
|
22
|
+
style: 'over-scroll no-wrap',
|
|
23
|
+
state: scroll === 'x'
|
|
24
|
+
},
|
|
25
|
+
scroll_y: {
|
|
26
|
+
style: 'over-scroll',
|
|
27
|
+
state: scroll === 'y'
|
|
28
|
+
},
|
|
29
|
+
scroll_hide: {
|
|
30
|
+
style: 'over-hide',
|
|
31
|
+
state: scroll === 'hide'
|
|
32
|
+
}
|
|
33
|
+
}"
|
|
34
|
+
@on_touchmove="$_touch_move"
|
|
35
|
+
:class="scroll_class">
|
|
36
|
+
<slot />
|
|
37
|
+
</b-view>
|
|
38
|
+
|
|
39
|
+
</b-view>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import ChapterLink from "./lib/ChapterLink"
|
|
44
|
+
import BView from "./b-view"
|
|
45
|
+
import BHot from "./b-hot"
|
|
46
|
+
import BIcon from "./b-icon"
|
|
47
|
+
|
|
48
|
+
const desc = ["该组件用于实现长内容的溢出滚动及隐藏效果,此外还具备滚动条定位监听及懒加载接口。"],
|
|
49
|
+
extend = [],
|
|
50
|
+
dependent = ["ChapterLink", "b-view", "b-hot", "b-icon"],
|
|
51
|
+
api = {
|
|
52
|
+
methods: [
|
|
53
|
+
{
|
|
54
|
+
name: "reset",
|
|
55
|
+
ef: "重置定位",
|
|
56
|
+
params: "-",
|
|
57
|
+
return: "-"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
event: [
|
|
61
|
+
{
|
|
62
|
+
name: "on_to_top",
|
|
63
|
+
ef: "滚动置顶",
|
|
64
|
+
params: "spread"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "on_to_bottom",
|
|
68
|
+
ef: "滚动置底",
|
|
69
|
+
params: "event"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "on_scroll",
|
|
73
|
+
ef: "滚动",
|
|
74
|
+
params: "{dir:scroll_direction, left:scroll_left, top:scroll_top}"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
init_data = `{
|
|
79
|
+
/* styles: "(参照:b-style 组件入参)" */,
|
|
80
|
+
/* wide: "加宽滚动条,默认 false" */,
|
|
81
|
+
/* scroll: "溢出滚动。y:垂直溢出滚动(默认);x:水平溢出滚动;hide:溢出隐藏" */,
|
|
82
|
+
/* goTopBtn: {
|
|
83
|
+
show_distance: "按钮显示时距离视口顶部的距离,默认为:false 不显示;可基于容器高度进行倍数设置:'1scr(即 1 屏的高度)',也支持具体数值",
|
|
84
|
+
response_direction: "按钮基于滑动方向响应式显示,默认关闭",
|
|
85
|
+
pos: {
|
|
86
|
+
right: "距离右侧距离,默认 1rem",
|
|
87
|
+
bottom: "距离底部距离,默认 2rem"
|
|
88
|
+
},
|
|
89
|
+
colors: {
|
|
90
|
+
normal: {
|
|
91
|
+
icon: "常规状态图标色,默认 #777",
|
|
92
|
+
bg: "常规状态背景色,默认 dark",
|
|
93
|
+
},
|
|
94
|
+
hover: {
|
|
95
|
+
icon: "悬停状态图标色,默认 light",
|
|
96
|
+
bg: "悬停状态背景色,默认 rgba(0,0,0,.6)",
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
} */
|
|
100
|
+
}`;
|
|
101
|
+
|
|
102
|
+
let orig_scroll_pos = {x:0, y:0}; //滚动原始定位
|
|
103
|
+
|
|
104
|
+
export default {
|
|
105
|
+
name: "b-list",
|
|
106
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
107
|
+
components: {
|
|
108
|
+
BView,
|
|
109
|
+
BHot,
|
|
110
|
+
BIcon
|
|
111
|
+
},
|
|
112
|
+
props: {
|
|
113
|
+
styles: {
|
|
114
|
+
type: String,
|
|
115
|
+
required: false
|
|
116
|
+
},
|
|
117
|
+
scroll: {
|
|
118
|
+
type: String,
|
|
119
|
+
required: false,
|
|
120
|
+
default: "y"
|
|
121
|
+
},
|
|
122
|
+
wide: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
required: false
|
|
125
|
+
},
|
|
126
|
+
goTopBtn: {
|
|
127
|
+
type: Object,
|
|
128
|
+
required: false,
|
|
129
|
+
default: ()=>{
|
|
130
|
+
return {}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
watch: {
|
|
135
|
+
|
|
136
|
+
//监听路由
|
|
137
|
+
$route(){
|
|
138
|
+
this.reset();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
},
|
|
142
|
+
data(){
|
|
143
|
+
return {
|
|
144
|
+
|
|
145
|
+
//定位器
|
|
146
|
+
chapter_link: new ChapterLink(0),
|
|
147
|
+
|
|
148
|
+
//触控滑动方向
|
|
149
|
+
touch_move_dir: "v",
|
|
150
|
+
|
|
151
|
+
//置顶按钮隐藏状态
|
|
152
|
+
top_btn_hide: true,
|
|
153
|
+
|
|
154
|
+
//置顶按钮显示,距离容器顶部距离
|
|
155
|
+
show_distance: 0
|
|
156
|
+
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
computed: {
|
|
160
|
+
|
|
161
|
+
//滚动容器
|
|
162
|
+
$list(){
|
|
163
|
+
return this.$refs.list.$el;
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
//溢出样式
|
|
167
|
+
scroll_class(){
|
|
168
|
+
switch(this.scroll){
|
|
169
|
+
case "x":
|
|
170
|
+
return "auto-h-scroll no-wrap";
|
|
171
|
+
break;
|
|
172
|
+
case "y":
|
|
173
|
+
return this.wide? "wide-auto-scroll": "auto-scroll";
|
|
174
|
+
break;
|
|
175
|
+
case "hide":
|
|
176
|
+
return "over-hide";
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
//置顶按钮配置
|
|
181
|
+
go_top_btn(){
|
|
182
|
+
return {
|
|
183
|
+
show_distance: false,
|
|
184
|
+
response_direction: false,
|
|
185
|
+
pos: {
|
|
186
|
+
right: "1",
|
|
187
|
+
bottom: "2"
|
|
188
|
+
},
|
|
189
|
+
colors: {
|
|
190
|
+
normal: {
|
|
191
|
+
icon: "#777",
|
|
192
|
+
bg: "dark",
|
|
193
|
+
},
|
|
194
|
+
hover: {
|
|
195
|
+
icon: "light",
|
|
196
|
+
bg: "rgba(0,0,0,.6)",
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
...this.goTopBtn
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
},
|
|
204
|
+
methods: {
|
|
205
|
+
|
|
206
|
+
//重置定位
|
|
207
|
+
reset(){
|
|
208
|
+
this.chapter_link.go_top(this.$list, 0);
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
//滚动定位监听
|
|
212
|
+
$_watch_pos(){
|
|
213
|
+
this.$list.onscroll = (e)=>{
|
|
214
|
+
const st = e.target.scrollTop,
|
|
215
|
+
sl = e.target.scrollLeft,
|
|
216
|
+
h_offset = sl - orig_scroll_pos.x,
|
|
217
|
+
v_offset = st - orig_scroll_pos.y;
|
|
218
|
+
let dir;
|
|
219
|
+
if(Math.abs(h_offset) >= Math.abs(v_offset)){ //水平方向
|
|
220
|
+
e.stopPropagation();
|
|
221
|
+
dir = h_offset >= 0? "l2r": "r2l";
|
|
222
|
+
}else { //垂直方向
|
|
223
|
+
dir = v_offset >= 0? "t2b": "b2t";
|
|
224
|
+
}
|
|
225
|
+
orig_scroll_pos.x = sl;
|
|
226
|
+
orig_scroll_pos.y = st;
|
|
227
|
+
this.$emit("on_scroll", {dir, left:sl, top:st});
|
|
228
|
+
|
|
229
|
+
st === 0 && this.$emit("on_to_top", e); //滚动置顶
|
|
230
|
+
st === e.target.scrollHeight - e.target.offsetHeight && this.$emit("on_to_bottom", e); //滚动置底
|
|
231
|
+
this.go_top_btn.show_distance && this.$_set_top_btn(dir, st); //设置置顶按钮
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
//触控移动
|
|
236
|
+
$_touch_move(e){
|
|
237
|
+
this.scroll === "x" && e.stopPropagation();
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
//设置置顶按钮显示,距离容器顶部距离
|
|
241
|
+
$_set_show_distance(){
|
|
242
|
+
const show_distance = this.go_top_btn.show_distance;
|
|
243
|
+
if(!show_distance) return;
|
|
244
|
+
const distance = this.go_top_btn.show_distance.split("scr");
|
|
245
|
+
if(distance.length > 1){ //基于容器高度的倍数
|
|
246
|
+
this.show_distance = distance[0] * this.$el.clientHeight;
|
|
247
|
+
}else { //具体值
|
|
248
|
+
this.show_distance = distance[0];
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
//设置置顶按钮
|
|
253
|
+
$_set_top_btn(dir, top){
|
|
254
|
+
if(top > this.show_distance) { //显示
|
|
255
|
+
this.top_btn_hide = false;
|
|
256
|
+
if(this.go_top_btn.response_direction){ //滚动方向响应显示状态
|
|
257
|
+
if(dir === "b2t"){
|
|
258
|
+
this.top_btn_hide = false;
|
|
259
|
+
}else {
|
|
260
|
+
this.top_btn_hide = true;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}else { //隐藏
|
|
264
|
+
this.top_btn_hide = true;
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
|
|
268
|
+
},
|
|
269
|
+
mounted(){
|
|
270
|
+
this.$_watch_pos();
|
|
271
|
+
setTimeout(()=>{
|
|
272
|
+
this.$_set_show_distance();
|
|
273
|
+
}, 1000);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<styles :class="class">
|
|
3
|
+
<span :class="class">
|
|
4
|
+
<slot/>
|
|
5
|
+
</span>
|
|
6
|
+
</styles>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import styles from "@/components/BTXUI/core/styles/index.vue"
|
|
11
|
+
|
|
12
|
+
defineProps<{
|
|
13
|
+
// 样式集
|
|
14
|
+
class?: string
|
|
15
|
+
}>()
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<textarea :style="computed_style" :type="type" :name="name"
|
|
3
|
+
class="auto-scroll"
|
|
4
|
+
@focus="$_focus"
|
|
5
|
+
@blur="$_blur"
|
|
6
|
+
@change="$_check"
|
|
7
|
+
v-model="value"
|
|
8
|
+
autocomplete="off"
|
|
9
|
+
:rows="rows"/>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import BInput from "./b-input";
|
|
14
|
+
|
|
15
|
+
let desc = ["该组件用于实现多行输入型表单元素。"],
|
|
16
|
+
extend = ["b-input"],
|
|
17
|
+
dependent = [],
|
|
18
|
+
api = {
|
|
19
|
+
extend: "继承自:<code>b-input</code> 组件",
|
|
20
|
+
methods: [
|
|
21
|
+
{
|
|
22
|
+
name: "to_html",
|
|
23
|
+
ef: "将换行符转换为 html <br> 标签",
|
|
24
|
+
params: "-",
|
|
25
|
+
return: "html_str"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
init_data = `{
|
|
30
|
+
"(继承自:b-input 组件入参,type 入参无效)",
|
|
31
|
+
/* rows: "显示最大行数,默认 7 行" */
|
|
32
|
+
}`;
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
extends: BInput,
|
|
36
|
+
name: "b-textarea",
|
|
37
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
38
|
+
props: {
|
|
39
|
+
type: {
|
|
40
|
+
type: String,
|
|
41
|
+
required: false,
|
|
42
|
+
},
|
|
43
|
+
rows: {
|
|
44
|
+
type: Number,
|
|
45
|
+
required: false,
|
|
46
|
+
default: 7
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
methods: {
|
|
50
|
+
|
|
51
|
+
//将换行符转换为 html <br> 标签
|
|
52
|
+
to_html(){
|
|
53
|
+
return this.inpVal.replace(/[\n\r]/g, "<br>")
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<video :style="computed_style" muted
|
|
3
|
+
:src="video"></video>
|
|
4
|
+
</template>
|
|
5
|
+
|
|
6
|
+
<script>
|
|
7
|
+
|
|
8
|
+
let desc = ["该组件用于实现视频播放器。"],
|
|
9
|
+
extend = ["b-style"],
|
|
10
|
+
dependent = [],
|
|
11
|
+
api = null,
|
|
12
|
+
init_data = `{
|
|
13
|
+
video: "视频资源",
|
|
14
|
+
/* styles: "(参照:b-style 组件入参)" */,
|
|
15
|
+
}`;
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: "b-video",
|
|
19
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
20
|
+
props: {
|
|
21
|
+
video: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
methods: {
|
|
27
|
+
|
|
28
|
+
//播放
|
|
29
|
+
play(){
|
|
30
|
+
this.$el.play();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<styles :class="class">
|
|
3
|
+
<div :class="class"
|
|
4
|
+
:style="{backgroundImage: `url(${ bgImg })`}">
|
|
5
|
+
<slot/>
|
|
6
|
+
</div>
|
|
7
|
+
</styles>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import styles from "@/components/BTXUI/core/styles/index.vue"
|
|
12
|
+
|
|
13
|
+
defineProps<{
|
|
14
|
+
// 样式集
|
|
15
|
+
class?: string,
|
|
16
|
+
|
|
17
|
+
// 背景图
|
|
18
|
+
bgImg?: string,
|
|
19
|
+
}>()
|
|
20
|
+
</script>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<iframe width="100%" height="100%" frameborder="0" :src="src"></iframe>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: "b-webview",
|
|
8
|
+
/*
|
|
9
|
+
* init-data{
|
|
10
|
+
* src: "web 地址",
|
|
11
|
+
* }
|
|
12
|
+
* */
|
|
13
|
+
props: {
|
|
14
|
+
src: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
class ChapterLink {
|
|
2
|
+
constructor(ani_speed=.2, offset=0, callback=null){
|
|
3
|
+
this.ani_speed = ani_speed; //平移动画缓动速率:0 - 1,默认:0.2,0 为硬切换"
|
|
4
|
+
this.offset = offset; //位移偏移
|
|
5
|
+
this.callback = callback; //滚动完成回调函数
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
//跳转指定 dom 章节
|
|
9
|
+
go_chapter(id){
|
|
10
|
+
let $chapter = document.querySelector("#" + id);
|
|
11
|
+
$chapter && this.go_top($chapter.offsetParent, $chapter.offsetTop + this.offset);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//跳转指定位置
|
|
15
|
+
go_top($box, top){
|
|
16
|
+
top = Math.min(Math.max(0, top), $box.scrollHeight - $box.offsetHeight); //校正滚动范围
|
|
17
|
+
if($box.nodeName === "BODY") $box = document.documentElement;
|
|
18
|
+
if(this.ani_speed > 0){ //平滑跳转
|
|
19
|
+
let offset;
|
|
20
|
+
this.$_stop_scroll();
|
|
21
|
+
ChapterLink.t = setInterval(()=>{
|
|
22
|
+
offset = (top - $box.scrollTop) * this.ani_speed;
|
|
23
|
+
if(offset === 0){
|
|
24
|
+
this.$_scroll_over();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if(Math.abs(offset) < 1) offset = offset < 0? -1: 1;
|
|
28
|
+
$box.scrollTop += offset;
|
|
29
|
+
}, 17);
|
|
30
|
+
}else { //硬跳转
|
|
31
|
+
$box.scrollTop = top;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//终止滚动
|
|
36
|
+
$_stop_scroll(){
|
|
37
|
+
clearInterval(ChapterLink.t);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//滚动停止
|
|
41
|
+
$_scroll_over(){
|
|
42
|
+
this.$_stop_scroll();
|
|
43
|
+
this.callback && this.callback();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
ChapterLink.t = null; //滚动计时器
|
|
48
|
+
|
|
49
|
+
export default ChapterLink
|