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,133 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<pannel-wid v-bind="pannel_prams" v-model="pannelInfo.visible">
|
|
3
|
+
<b-view :styles="pannel_styles">
|
|
4
|
+
<b-view v-if="pannelTitle" styles="pad-l-2">
|
|
5
|
+
<b-view styles="line-b thick-1 pad-v-.7 line-neutral">{{pannelTitle}}</b-view>
|
|
6
|
+
</b-view>
|
|
7
|
+
<b-list styles="pad-2">
|
|
8
|
+
<form-wid ref="former" v-bind="formData" v-model="pannelInfo.selected" />
|
|
9
|
+
</b-list>
|
|
10
|
+
</b-view>
|
|
11
|
+
</pannel-wid>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import BView from "@/components/BTXUI/core/b-view";
|
|
16
|
+
import BList from "@/components/BTXUI/core/b-list";
|
|
17
|
+
import PannelWid from "@/components/BTXUI/pannel/pannel-wid";
|
|
18
|
+
import FormWid from "@/components/BTXUI/form/form-wid";
|
|
19
|
+
|
|
20
|
+
const desc = ["该组件用于自定义弹窗交互操作。"],
|
|
21
|
+
extend = [],
|
|
22
|
+
dependent = ["form-wid", "pannel-wid", "b-list", "b-view"],
|
|
23
|
+
api = {
|
|
24
|
+
methods: [
|
|
25
|
+
{
|
|
26
|
+
name: "set_only_read",
|
|
27
|
+
ef: "设置表单项只读",
|
|
28
|
+
params: "name",
|
|
29
|
+
return: "-"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "set_write",
|
|
33
|
+
ef: "设置表单项可写",
|
|
34
|
+
params: "name",
|
|
35
|
+
return: "-"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
init_data = `{
|
|
40
|
+
pannelInfo: "(model){
|
|
41
|
+
visible: "面板显示状态",
|
|
42
|
+
selected: {
|
|
43
|
+
name(所选表单元素键名): value(所选表单元素键值),...
|
|
44
|
+
}
|
|
45
|
+
}",
|
|
46
|
+
formData: "(参照:form-wid 组件入参)",
|
|
47
|
+
/* pannelTitle: "面板标题" */,
|
|
48
|
+
/* pannelStyles: "面板样式" */,
|
|
49
|
+
/* pannelData: "(参照:pannel-wid 组件入参)" */,
|
|
50
|
+
}`;
|
|
51
|
+
|
|
52
|
+
export default {
|
|
53
|
+
name: "form-pannel-wid",
|
|
54
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
55
|
+
components: {
|
|
56
|
+
BView,
|
|
57
|
+
BList,
|
|
58
|
+
PannelWid,
|
|
59
|
+
FormWid
|
|
60
|
+
},
|
|
61
|
+
model: {
|
|
62
|
+
prop: "pannelInfo"
|
|
63
|
+
},
|
|
64
|
+
props: {
|
|
65
|
+
pannelInfo: {
|
|
66
|
+
type: Object,
|
|
67
|
+
required: true
|
|
68
|
+
},
|
|
69
|
+
formData: {
|
|
70
|
+
type: Object,
|
|
71
|
+
required: true
|
|
72
|
+
},
|
|
73
|
+
pannelTitle: {
|
|
74
|
+
type: String,
|
|
75
|
+
required: false,
|
|
76
|
+
},
|
|
77
|
+
pannelStyles: {
|
|
78
|
+
type: String,
|
|
79
|
+
required: false,
|
|
80
|
+
default: ""
|
|
81
|
+
},
|
|
82
|
+
pannelData: {
|
|
83
|
+
type: Object,
|
|
84
|
+
required: false
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
data(){
|
|
88
|
+
return {
|
|
89
|
+
|
|
90
|
+
//面板初始化样式
|
|
91
|
+
pannel_styles: `flex-column bg-color-light w-30 round-sm ${this.pannelStyles}`,
|
|
92
|
+
|
|
93
|
+
//面板初始化配置
|
|
94
|
+
pannel_prams: {
|
|
95
|
+
matte: true,
|
|
96
|
+
matteColor: "rgba(40,40,40,.7)",
|
|
97
|
+
matteClose: "click",
|
|
98
|
+
...this.pannelData,
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
computed: {
|
|
104
|
+
|
|
105
|
+
//表单对象
|
|
106
|
+
former(){
|
|
107
|
+
return this.$refs.former;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
},
|
|
111
|
+
methods: {
|
|
112
|
+
|
|
113
|
+
//设置表单项只读
|
|
114
|
+
set_only_read(name){
|
|
115
|
+
this.former.set_only_read(name);
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
//设置表单项可写
|
|
119
|
+
set_write(name){
|
|
120
|
+
this.former.set_write(name);
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
},
|
|
124
|
+
watch: {
|
|
125
|
+
|
|
126
|
+
//监听面板显示状态入参
|
|
127
|
+
"pannelInfo.visible"(val){
|
|
128
|
+
val === false && this.former.reset();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</script>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-view styles="flex">
|
|
3
|
+
|
|
4
|
+
<!--单图上传预览-->
|
|
5
|
+
<b-hot v-if="solo_cover" :styles="`flex bg-color-dgray alpha-.9 ${round}`"
|
|
6
|
+
key="solo"
|
|
7
|
+
hover="alpha-1"
|
|
8
|
+
@on_click="$_upload">
|
|
9
|
+
<b-img :styles="`w-${width} h-${height} ${round}`"
|
|
10
|
+
:img="solo_cover" />
|
|
11
|
+
</b-hot>
|
|
12
|
+
|
|
13
|
+
<!--上传按钮-->
|
|
14
|
+
<b-hot v-else :styles="`flex-5 pcenter pad-2 bg-color-neutral alpha-.8 ${round} w-${width} h-${height}`"
|
|
15
|
+
hover="alpha-1"
|
|
16
|
+
@on_click="$_upload" >
|
|
17
|
+
<b-view>
|
|
18
|
+
<b-icon icon="add" styles="scale-1.5" />
|
|
19
|
+
<b-view v-if="notic" styles="alpha-.4 mrg-t-.7 fsize-.9">{{notic}}</b-view>
|
|
20
|
+
</b-view>
|
|
21
|
+
</b-hot>
|
|
22
|
+
|
|
23
|
+
<!--多图上传预览-->
|
|
24
|
+
<template v-if="previews.length > 1">
|
|
25
|
+
<b-img v-for="(img,index) of previews" :key="index"
|
|
26
|
+
:styles="`mrg-l-1 w-${width} h-${height} ${round}`"
|
|
27
|
+
:img="img" />
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<input type="file" style="display: none" ref="uploader" @change="$_exe_upload" :multiple="multiple"/>
|
|
31
|
+
</b-view>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import UploadWid from "@/components/BTXUI/upload/upload-wid"
|
|
36
|
+
import BView from "@/components/BTXUI/core/b-view"
|
|
37
|
+
import BHot from "@/components/BTXUI/core/b-hot"
|
|
38
|
+
import BImg from "@/components/BTXUI/core/b-img"
|
|
39
|
+
import BIcon from "@/components/BTXUI/core/b-icon"
|
|
40
|
+
|
|
41
|
+
const desc = ["该组件用于图片上传操作,支持预览功能。"],
|
|
42
|
+
extend = ["upload-wid"],
|
|
43
|
+
dependent = ["b-icon", "b-img", "b-hot", "b-view"],
|
|
44
|
+
api = {
|
|
45
|
+
extend: "继承自:<code>upload-wid</code> 组件",
|
|
46
|
+
methods: [
|
|
47
|
+
{
|
|
48
|
+
name: "clear_preview",
|
|
49
|
+
ef: "清除预览图",
|
|
50
|
+
params: "-",
|
|
51
|
+
return: "-"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
init_data = `{
|
|
56
|
+
"继承自:upload-wid 组件入参。type、btnData 入参无效",
|
|
57
|
+
/* notic: "提示文字" */,
|
|
58
|
+
/* height: "热点区域高度" */,
|
|
59
|
+
/* width: "热点区域宽度" */,
|
|
60
|
+
/* round: "热点区域圆角" */
|
|
61
|
+
}`;
|
|
62
|
+
|
|
63
|
+
export default {
|
|
64
|
+
extends: UploadWid,
|
|
65
|
+
name: "imgs-upload-wid",
|
|
66
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
67
|
+
components: {
|
|
68
|
+
BView,
|
|
69
|
+
BHot,
|
|
70
|
+
BImg,
|
|
71
|
+
BIcon
|
|
72
|
+
},
|
|
73
|
+
props: {
|
|
74
|
+
notic: {
|
|
75
|
+
type: String,
|
|
76
|
+
required: false
|
|
77
|
+
},
|
|
78
|
+
width: {
|
|
79
|
+
type: [Number, String],
|
|
80
|
+
required: false,
|
|
81
|
+
default: 8
|
|
82
|
+
},
|
|
83
|
+
height: {
|
|
84
|
+
type: [Number, String],
|
|
85
|
+
required: false,
|
|
86
|
+
default: 5
|
|
87
|
+
},
|
|
88
|
+
round: {
|
|
89
|
+
type: String,
|
|
90
|
+
required: false,
|
|
91
|
+
default: "round-sm"
|
|
92
|
+
},
|
|
93
|
+
type: {
|
|
94
|
+
type: Array,
|
|
95
|
+
required: false,
|
|
96
|
+
default: ()=>["png", "jpg", "jpeg", "gif", "svg"]
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
data(){
|
|
100
|
+
return {
|
|
101
|
+
|
|
102
|
+
//预览图源
|
|
103
|
+
img_res: null
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
computed: {
|
|
108
|
+
|
|
109
|
+
//预览图
|
|
110
|
+
previews(){
|
|
111
|
+
const img_res = this.img_res,
|
|
112
|
+
remote_files = this.remote_files;
|
|
113
|
+
return img_res? img_res: (remote_files || []);
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
//单预览图
|
|
117
|
+
solo_cover(){
|
|
118
|
+
return this.multiple? false: this.previews[0];
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
},
|
|
122
|
+
watch: {
|
|
123
|
+
|
|
124
|
+
//监听上传文件进行预览
|
|
125
|
+
"upload_file.files"(){
|
|
126
|
+
if(!this.uploadApi){
|
|
127
|
+
this.img_res = [];
|
|
128
|
+
[].forEach.call(this.upload_file.files, file=>{
|
|
129
|
+
const file_reader = new FileReader();
|
|
130
|
+
file_reader.onload = (res)=>{
|
|
131
|
+
this.img_res.push(res.target.result);
|
|
132
|
+
}
|
|
133
|
+
file_reader.readAsDataURL(file);
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
},
|
|
139
|
+
methods: {
|
|
140
|
+
|
|
141
|
+
//清除预览图
|
|
142
|
+
clear_preview(){
|
|
143
|
+
this.img_res = null;
|
|
144
|
+
this.uploader.value = "";
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
</script>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import Vue from "vue"
|
|
2
|
+
|
|
3
|
+
//基础组件
|
|
4
|
+
import BGrid from "./core/b-grid"
|
|
5
|
+
import BHot from "./core/b-hot"
|
|
6
|
+
import BDrag from "./core/b-drag"
|
|
7
|
+
import BIcon from "./core/b-icon"
|
|
8
|
+
import BImg from "./core/b-img"
|
|
9
|
+
import BInput from "./core/b-input"
|
|
10
|
+
import BList from "./core/b-list"
|
|
11
|
+
import BText from "./core/b-text"
|
|
12
|
+
import BTextarea from "./core/b-textarea"
|
|
13
|
+
import BView from "./core/b-view"
|
|
14
|
+
import BVideo from "./core/b-video"
|
|
15
|
+
import BWebview from "./core/b-webview"
|
|
16
|
+
|
|
17
|
+
//应用组件
|
|
18
|
+
import BtnWid from "./btn/btn-wid"
|
|
19
|
+
import CheckboxWid from "./checkbox/checkbox-wid"
|
|
20
|
+
import ContentWid from "./content/content-wid"
|
|
21
|
+
import CarouselWid from "./carousel/carousel-wid"
|
|
22
|
+
import DrawerWid from "./drawer/drawer-wid"
|
|
23
|
+
import FormWid from "./form/form-wid"
|
|
24
|
+
import FormPannelWid from "./formPannel/form-pannel-wid"
|
|
25
|
+
import ImgsUploadWid from "./imgsUpload/imgs-upload-wid"
|
|
26
|
+
import PageFlipWid from "./pageFlip/page-flip-wid"
|
|
27
|
+
import PannelWid from "./pannel/pannel-wid"
|
|
28
|
+
import SelectWid from "./select/select-wid"
|
|
29
|
+
import SliderWid from "./slider/slider-wid"
|
|
30
|
+
import RangeWid from "./range/range-wid"
|
|
31
|
+
import SearchWid from "./search/search-wid"
|
|
32
|
+
import TabWid from "./tab/tab-wid"
|
|
33
|
+
import TableWid from "./table/table-wid"
|
|
34
|
+
import TagWid from "./tag/tag-wid"
|
|
35
|
+
import TagsWid from "./tags/tags-wid"
|
|
36
|
+
import TooltipWid from "./tooltip/tooltip-wid"
|
|
37
|
+
import UploadWid from "./upload/upload-wid"
|
|
38
|
+
import AppWid from "./app/app-wid"
|
|
39
|
+
|
|
40
|
+
const components = {
|
|
41
|
+
core: [
|
|
42
|
+
BGrid,
|
|
43
|
+
BHot,
|
|
44
|
+
BDrag,
|
|
45
|
+
BIcon,
|
|
46
|
+
BImg,
|
|
47
|
+
BInput,
|
|
48
|
+
BList,
|
|
49
|
+
BText,
|
|
50
|
+
BTextarea,
|
|
51
|
+
BView,
|
|
52
|
+
BVideo,
|
|
53
|
+
BWebview
|
|
54
|
+
],
|
|
55
|
+
wids: [
|
|
56
|
+
BtnWid,
|
|
57
|
+
CheckboxWid,
|
|
58
|
+
ContentWid,
|
|
59
|
+
CarouselWid,
|
|
60
|
+
DrawerWid,
|
|
61
|
+
FormWid,
|
|
62
|
+
FormPannelWid,
|
|
63
|
+
ImgsUploadWid,
|
|
64
|
+
PageFlipWid,
|
|
65
|
+
PannelWid,
|
|
66
|
+
SelectWid,
|
|
67
|
+
SliderWid,
|
|
68
|
+
RangeWid,
|
|
69
|
+
SearchWid,
|
|
70
|
+
TabWid,
|
|
71
|
+
TableWid,
|
|
72
|
+
TagWid,
|
|
73
|
+
TagsWid,
|
|
74
|
+
TooltipWid,
|
|
75
|
+
UploadWid,
|
|
76
|
+
AppWid,
|
|
77
|
+
]
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//加载核心组件
|
|
81
|
+
[...components.core, ...components.wids].forEach((wid)=>{
|
|
82
|
+
Vue.component(wid.name, wid);
|
|
83
|
+
})
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-view :styles="`flex-${align_style}`">
|
|
3
|
+
<b-hot :styles="`round w-4 h-4 flex-5 fsize-1.4 mrg-r-1.4 bg-color-${colors.bg} color-${colors.text}`"
|
|
4
|
+
:hover="`bg-color-${colors.hover}`"
|
|
5
|
+
@on_click="prev">
|
|
6
|
+
<b-icon icon="arrow-left" />
|
|
7
|
+
</b-hot>
|
|
8
|
+
|
|
9
|
+
<!--页码-->
|
|
10
|
+
<b-text styles="alpha-.5" v-show="pages[0] > 1">...</b-text>
|
|
11
|
+
<b-hot v-for="page of pages"
|
|
12
|
+
:styles="`pad-h-.6 fsize-1.3 color-${colors.text}`"
|
|
13
|
+
:states="{
|
|
14
|
+
act: {
|
|
15
|
+
state: page === cur_page,
|
|
16
|
+
style: `color-${colors.act}`
|
|
17
|
+
}
|
|
18
|
+
}"
|
|
19
|
+
:hover="`color-${colors.hover}`"
|
|
20
|
+
@on_click="flip(page)"
|
|
21
|
+
:key="page">
|
|
22
|
+
{{page}}
|
|
23
|
+
</b-hot>
|
|
24
|
+
<b-text styles="alpha-.5" v-show="pages[pages.length - 1] < total">...</b-text>
|
|
25
|
+
|
|
26
|
+
<b-hot :styles="`round w-4 h-4 flex-5 fsize-1.4 mrg-l-1.4 bg-color-${colors.bg} color-${colors.text}`"
|
|
27
|
+
:hover="`bg-color-${colors.hover}`"
|
|
28
|
+
@on_click="next">
|
|
29
|
+
<b-icon icon="arrow-right" />
|
|
30
|
+
</b-hot>
|
|
31
|
+
</b-view>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import BView from "@/components/BTXUI/core/b-view";
|
|
36
|
+
import BHot from "@/components/BTXUI/core/b-hot";
|
|
37
|
+
import BText from "@/components/BTXUI/core/b-text";
|
|
38
|
+
import BIcon from "@/components/BTXUI/core/b-icon";
|
|
39
|
+
|
|
40
|
+
const desc = ["该组件用于实现分页导航按钮。"],
|
|
41
|
+
extend = [],
|
|
42
|
+
dependent = ["b-icon", "b-hot", "b-view", "b-text"],
|
|
43
|
+
api = {
|
|
44
|
+
methods: [
|
|
45
|
+
{
|
|
46
|
+
name: "next",
|
|
47
|
+
ef: "向后翻页",
|
|
48
|
+
params: "-",
|
|
49
|
+
return: "-"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "prev",
|
|
53
|
+
ef: "向前翻页",
|
|
54
|
+
params: "-",
|
|
55
|
+
return: "-"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "flip",
|
|
59
|
+
ef: "指定页码翻页",
|
|
60
|
+
params: "page",
|
|
61
|
+
return: "-"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
event: [
|
|
65
|
+
{
|
|
66
|
+
name: "on_flip",
|
|
67
|
+
ef: "点击分页",
|
|
68
|
+
params: "cur_page"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
init_data = `{
|
|
73
|
+
total: "总页数",
|
|
74
|
+
/* curPage: "当前页,默认为 1" */,
|
|
75
|
+
/* limit: "页码显示限制,默认为 4" */,
|
|
76
|
+
/* colors: {
|
|
77
|
+
bg: "按钮颜色",
|
|
78
|
+
text: "文字及图标颜色",
|
|
79
|
+
hover: "悬停状态按钮颜色及文字、图标颜色",
|
|
80
|
+
act: "页码激活颜色"
|
|
81
|
+
} */,
|
|
82
|
+
/* align: "水平对齐方式,默认 center" */,
|
|
83
|
+
}`;
|
|
84
|
+
|
|
85
|
+
export default {
|
|
86
|
+
name: "page-flip-wid",
|
|
87
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
88
|
+
components: {
|
|
89
|
+
BView,
|
|
90
|
+
BText,
|
|
91
|
+
BIcon,
|
|
92
|
+
BHot
|
|
93
|
+
},
|
|
94
|
+
props: {
|
|
95
|
+
total: {
|
|
96
|
+
type: Number,
|
|
97
|
+
required: true
|
|
98
|
+
},
|
|
99
|
+
curPage: {
|
|
100
|
+
type: Number,
|
|
101
|
+
required: false,
|
|
102
|
+
default: 1
|
|
103
|
+
},
|
|
104
|
+
limit: {
|
|
105
|
+
type: Number,
|
|
106
|
+
required: false,
|
|
107
|
+
default: 4
|
|
108
|
+
},
|
|
109
|
+
colors: {
|
|
110
|
+
type: Object,
|
|
111
|
+
required: false,
|
|
112
|
+
default: ()=>{
|
|
113
|
+
return {
|
|
114
|
+
bg: "neutral",
|
|
115
|
+
text: "dgray",
|
|
116
|
+
hover: "mgray",
|
|
117
|
+
act: "blue",
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
align: {
|
|
122
|
+
type: String,
|
|
123
|
+
required: false,
|
|
124
|
+
default: "center"
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
data(){
|
|
128
|
+
return {
|
|
129
|
+
|
|
130
|
+
//当前页
|
|
131
|
+
cur_page: this.$_set_page(this.curPage),
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
computed: {
|
|
136
|
+
|
|
137
|
+
//显示页码
|
|
138
|
+
pages(){
|
|
139
|
+
//场景:1.不足 limit;2.等于 limit;3.超过 limit,后续;4.超过 limit,前续;5.超过 limit,前后续
|
|
140
|
+
const pages = [];
|
|
141
|
+
if(this.total !== Infinity){
|
|
142
|
+
const cur_page = this.cur_page,
|
|
143
|
+
limit = this.limit,
|
|
144
|
+
rem = cur_page % limit,
|
|
145
|
+
pos = rem > 0? rem: limit,
|
|
146
|
+
before = Math.max(1, cur_page - pos + 1),
|
|
147
|
+
after = Math.min(cur_page + limit - pos, this.total);
|
|
148
|
+
for(let i=before; i<=after; i++) pages.push(i)
|
|
149
|
+
}
|
|
150
|
+
return pages;
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
//对齐样式
|
|
154
|
+
align_style(){
|
|
155
|
+
let val;
|
|
156
|
+
switch(this.align){
|
|
157
|
+
case "left": val = 4;
|
|
158
|
+
break;
|
|
159
|
+
case "right": val = 6;
|
|
160
|
+
break;
|
|
161
|
+
default: val = 5;
|
|
162
|
+
}
|
|
163
|
+
return val
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
},
|
|
167
|
+
methods: {
|
|
168
|
+
|
|
169
|
+
//向后翻页
|
|
170
|
+
next(){
|
|
171
|
+
this.flip(this.cur_page + 1);
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
//向前翻页
|
|
175
|
+
prev(){
|
|
176
|
+
this.flip(this.cur_page - 1);
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
//翻页
|
|
180
|
+
flip(page){
|
|
181
|
+
const cur_page = this.$_set_page(page);
|
|
182
|
+
if(cur_page !== this.cur_page){
|
|
183
|
+
this.cur_page = cur_page;
|
|
184
|
+
this.$emit("on_flip", this.cur_page)
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
//设置当前页
|
|
189
|
+
$_set_page(page){
|
|
190
|
+
return Math.min(Math.max(1, isNaN(page)? 1: page), this.total);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
},
|
|
194
|
+
watch: {
|
|
195
|
+
|
|
196
|
+
total(){
|
|
197
|
+
this.cur_page = this.$_set_page(this.curPage)
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
curPage(){
|
|
201
|
+
this.cur_page = this.$_set_page(this.curPage)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
</script>
|