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.
Files changed (190) hide show
  1. package/README.md +42 -0
  2. package/app.vue +162 -0
  3. package/assets/css/_main.js +73 -0
  4. package/assets/css/btx.min.css +1 -0
  5. package/assets/css/btx.mob.min.css +1 -0
  6. package/assets/css/btx.pad.min.css +1 -0
  7. package/assets/css/btx.webapp.min.css +1 -0
  8. package/assets/css/custom_fonts/iconfont.css +37 -0
  9. package/assets/css/custom_fonts/iconfont.eot +0 -0
  10. package/assets/css/custom_fonts/iconfont.svg +47 -0
  11. package/assets/css/custom_fonts/iconfont.ttf +0 -0
  12. package/assets/css/custom_fonts/iconfont.woff +0 -0
  13. package/assets/css/custom_fonts/iconfont.woff2 +0 -0
  14. package/assets/css/res-l.css +47 -0
  15. package/assets/css/res-m.css +47 -0
  16. package/assets/css/res-s.css +61 -0
  17. package/assets/custom_fonts/iconfont.css +37 -0
  18. package/assets/custom_fonts/iconfont.eot +0 -0
  19. package/assets/custom_fonts/iconfont.svg +47 -0
  20. package/assets/custom_fonts/iconfont.ttf +0 -0
  21. package/assets/custom_fonts/iconfont.woff +0 -0
  22. package/assets/custom_fonts/iconfont.woff2 +0 -0
  23. package/assets/js/Btx.js +196 -0
  24. package/assets/js/Utils.js +421 -0
  25. package/assets/js/fastclick.js +802 -0
  26. package/assets/js/lazy.min.js +2 -0
  27. package/assets/js/touchwipe.js +111 -0
  28. package/assets/server.js +8 -0
  29. package/assets/start_site_code_str.js +119 -0
  30. package/cdn/css/btx.min.css +1 -0
  31. package/cdn/css/btx.min.css.map +1 -0
  32. package/cdn/fonts/iconfont.ttf +0 -0
  33. package/cdn/fonts/iconfont.woff +0 -0
  34. package/cdn/fonts/iconfont.woff2 +0 -0
  35. package/components/BTXUI/app/app-wid.vue +182 -0
  36. package/components/BTXUI/btn/btn-wid.vue +128 -0
  37. package/components/BTXUI/carousel/carousel-wid.vue +138 -0
  38. package/components/BTXUI/checkbox/checkbox-wid.vue +72 -0
  39. package/components/BTXUI/confirm/confirm-wid.vue +279 -0
  40. package/components/BTXUI/content/content-checkbox-wid.vue +44 -0
  41. package/components/BTXUI/content/content-node-wid.vue +114 -0
  42. package/components/BTXUI/content/content-tag-wid.vue +25 -0
  43. package/components/BTXUI/content/content-wid.vue +254 -0
  44. package/components/BTXUI/core/anis/ani-fail.vue +46 -0
  45. package/components/BTXUI/core/anis/ani-loading.vue +32 -0
  46. package/components/BTXUI/core/anis/ani-notic.vue +47 -0
  47. package/components/BTXUI/core/anis/ani-success.vue +48 -0
  48. package/components/BTXUI/core/b-drag.vue +258 -0
  49. package/components/BTXUI/core/b-grid.vue +84 -0
  50. package/components/BTXUI/core/b-hot.vue +171 -0
  51. package/components/BTXUI/core/b-icon.vue +76 -0
  52. package/components/BTXUI/core/b-img.vue +84 -0
  53. package/components/BTXUI/core/b-input.vue +198 -0
  54. package/components/BTXUI/core/b-list.vue +276 -0
  55. package/components/BTXUI/core/b-text/doc.ts +9 -0
  56. package/components/BTXUI/core/b-text/index.vue +16 -0
  57. package/components/BTXUI/core/b-textarea.vue +58 -0
  58. package/components/BTXUI/core/b-video.vue +35 -0
  59. package/components/BTXUI/core/b-view/doc.ts +10 -0
  60. package/components/BTXUI/core/b-view/index.vue +20 -0
  61. package/components/BTXUI/core/b-webview.vue +20 -0
  62. package/components/BTXUI/core/lib/ChapterLink.js +49 -0
  63. package/components/BTXUI/core/lib/Search.vue +60 -0
  64. package/components/BTXUI/core/styles/doc.ts +55 -0
  65. package/components/BTXUI/core/styles/index.vue +98 -0
  66. package/components/BTXUI/core/styles/prestyles.ts +471 -0
  67. package/components/BTXUI/core/styles/theme.ts +29 -0
  68. package/components/BTXUI/drawer/drawer-wid.vue +165 -0
  69. package/components/BTXUI/drawer/title-tag-wid.vue +114 -0
  70. package/components/BTXUI/form/form-select-wid.vue +57 -0
  71. package/components/BTXUI/form/form-wid.vue +324 -0
  72. package/components/BTXUI/formPannel/form-pannel-wid.vue +133 -0
  73. package/components/BTXUI/imgsUpload/imgs-upload-wid.vue +149 -0
  74. package/components/BTXUI/index.js +83 -0
  75. package/components/BTXUI/pageFlip/page-flip-wid.vue +206 -0
  76. package/components/BTXUI/pannel/pannel-wid.vue +167 -0
  77. package/components/BTXUI/range/range-wid.vue +134 -0
  78. package/components/BTXUI/search/search-wid.vue +80 -0
  79. package/components/BTXUI/select/select-wid.vue +186 -0
  80. package/components/BTXUI/slider/slider-wid.vue +444 -0
  81. package/components/BTXUI/tab/tab-wid.vue +109 -0
  82. package/components/BTXUI/table/table-wid.vue +324 -0
  83. package/components/BTXUI/tag/tag-wid.vue +183 -0
  84. package/components/BTXUI/tags/tags-wid.vue +121 -0
  85. package/components/BTXUI/tooltip/tooltip-wid.vue +146 -0
  86. package/components/BTXUI/upload/upload-wid.vue +215 -0
  87. package/components/BTXUI/waterfall/waterfall-wid.vue +166 -0
  88. package/components/header-info.vue +167 -0
  89. package/composables/@types.ts +4 -0
  90. package/composables/api.ts +18 -0
  91. package/env.d.ts +5 -0
  92. package/main.js +6 -0
  93. package/nuxt.config.ts +51 -0
  94. package/package.json +23 -0
  95. package/pages/article.vue +16 -0
  96. package/pages/download.vue +50 -0
  97. package/pages/example/app_wid/app/data_demo.vue +9 -0
  98. package/pages/example/app_wid/app/download_demo.vue +9 -0
  99. package/pages/example/app_wid/app/list_demo.vue +11 -0
  100. package/pages/example/app_wid/app/system_demo.vue +9 -0
  101. package/pages/example/app_wid/app_wid_demo.vue +198 -0
  102. package/pages/example/app_wid/btn_wid_demo.vue +179 -0
  103. package/pages/example/app_wid/carousel_wid_demo.vue +152 -0
  104. package/pages/example/app_wid/checkbox_wid_demo.vue +65 -0
  105. package/pages/example/app_wid/confirm_wid_demo.vue +197 -0
  106. package/pages/example/app_wid/content_wid_demo.vue +369 -0
  107. package/pages/example/app_wid/drawer_wid_demo.vue +155 -0
  108. package/pages/example/app_wid/form_pannel_wid_demo.vue +338 -0
  109. package/pages/example/app_wid/form_wid_demo.vue +550 -0
  110. package/pages/example/app_wid/imgs_upload_wid_demo.vue +159 -0
  111. package/pages/example/app_wid/index.js +158 -0
  112. package/pages/example/app_wid/page_flip_wid_demo.vue +99 -0
  113. package/pages/example/app_wid/pannel_wid_demo.vue +177 -0
  114. package/pages/example/app_wid/range_wid_demo.vue +101 -0
  115. package/pages/example/app_wid/search_wid_demo.vue +75 -0
  116. package/pages/example/app_wid/select_wid_demo.vue +217 -0
  117. package/pages/example/app_wid/slider_wid_demo.vue +143 -0
  118. package/pages/example/app_wid/tab_wid_demo.vue +170 -0
  119. package/pages/example/app_wid/table_wid_demo.vue +377 -0
  120. package/pages/example/app_wid/tag_wid_demo.vue +133 -0
  121. package/pages/example/app_wid/tags_wid_demo.vue +143 -0
  122. package/pages/example/app_wid/tooltip_wid_demo.vue +117 -0
  123. package/pages/example/app_wid/upload_wid_demo.vue +123 -0
  124. package/pages/example/base_wid/b_drag_demo.vue +159 -0
  125. package/pages/example/base_wid/b_grid_demo.vue +225 -0
  126. package/pages/example/base_wid/b_hot_demo.vue +135 -0
  127. package/pages/example/base_wid/b_icon_demo.vue +80 -0
  128. package/pages/example/base_wid/b_img_demo.vue +95 -0
  129. package/pages/example/base_wid/b_input_demo.vue +171 -0
  130. package/pages/example/base_wid/b_list_demo.vue +241 -0
  131. package/pages/example/base_wid/b_style_demo.vue +928 -0
  132. package/pages/example/base_wid/b_text_demo.vue +36 -0
  133. package/pages/example/base_wid/b_textarea_demo.vue +64 -0
  134. package/pages/example/base_wid/b_video_demo.vue +42 -0
  135. package/pages/example/base_wid/b_view_demo.vue +36 -0
  136. package/pages/example/base_wid/index.js +76 -0
  137. package/pages/example/content.js +49 -0
  138. package/pages/example/global_style/animation.vue +197 -0
  139. package/pages/example/global_style/color.vue +134 -0
  140. package/pages/example/global_style/decoration.vue +546 -0
  141. package/pages/example/global_style/icon.vue +345 -0
  142. package/pages/example/global_style/index.js +52 -0
  143. package/pages/example/global_style/layout.vue +846 -0
  144. package/pages/example/global_style/special.vue +37 -0
  145. package/pages/example/global_style/table.vue +298 -0
  146. package/pages/example/global_style/text.vue +159 -0
  147. package/pages/index.vue +29 -0
  148. package/pages/level_widget.vue +11 -0
  149. package/pages/start.vue +200 -0
  150. package/plugins/index.ts +2 -0
  151. package/public/favicon.gif +0 -0
  152. package/public/fonts/iconfont.ttf +0 -0
  153. package/public/fonts/iconfont.woff +0 -0
  154. package/public/fonts/iconfont.woff2 +0 -0
  155. package/public/img/banner.jpg +0 -0
  156. package/public/img/banner2.jpg +0 -0
  157. package/public/img/bg_pattern.png +0 -0
  158. package/public/img/btx.jpg +0 -0
  159. package/public/img/btx_ui.jpg +0 -0
  160. package/public/img/dir.png +0 -0
  161. package/public/img/f.png +0 -0
  162. package/public/img/head.jpg +0 -0
  163. package/public/img/head2.jpg +0 -0
  164. package/public/img/home_ico.png +0 -0
  165. package/public/img/icons.svg +164 -0
  166. package/public/img/mechanism/b-style.png +0 -0
  167. package/public/img/mechanism/slider-wid.png +0 -0
  168. package/public/img/mechanism/upload-wid.png +0 -0
  169. package/public/img/transform_origin.png +0 -0
  170. package/sass/animation.scss +400 -0
  171. package/sass/btx.mob.scss +10 -0
  172. package/sass/btx.pad.scss +3 -0
  173. package/sass/btx.scss +22 -0
  174. package/sass/btx.webapp.scss +22 -0
  175. package/sass/colors.scss +65 -0
  176. package/sass/decoration.scss +220 -0
  177. package/sass/flex.scss +29 -0
  178. package/sass/icons.scss +100 -0
  179. package/sass/layout.scss +88 -0
  180. package/sass/reset.scss +111 -0
  181. package/sass/response/flex_mixin.scss +91 -0
  182. package/sass/response/layout_mixin.scss +227 -0
  183. package/sass/response/main.scss +59 -0
  184. package/sass/response/text_mixin.scss +65 -0
  185. package/sass/scroll.scss +100 -0
  186. package/sass/special.scss +13 -0
  187. package/sass/table.scss +103 -0
  188. package/sass/text.scss +86 -0
  189. package/sass/webpack.config.js +31 -0
  190. package/tsconfig.json +4 -0
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <b-hot @on_click="$_click"
3
+ v-bind="hotData"
4
+ :styles="`flex-5 pad-h-1.4 pad-v-.4 line thick-1 ellipsis ${btnRound? 'round-lg': 'round-sm'} ${btnWidth? 'w-' + btnWidth: ''} color-${btn_color.normal.text} ${$_set_bg(btn_color.normal.bg)} line-${btn_color.normal.line}`"
5
+ :hover="`color-${btn_color.hover.text} ${$_set_bg(btn_color.hover.bg)} line-${btn_color.hover.line}`">
6
+
7
+ <!--图标-->
8
+ <b-icon v-if="iconData" v-bind="iconData" styles="mrg-r-.7" />
9
+
10
+ {{btnText}}
11
+ </b-hot>
12
+ </template>
13
+
14
+ <script>
15
+ import BHot from "@/components/BTXUI/core/b-hot";
16
+ import BIcon from "@/components/BTXUI/core/b-icon";
17
+
18
+ const desc = ["该组件用于实现按钮交互操作。"],
19
+ extend = [],
20
+ dependent = ["b-icon", "b-hot"],
21
+ api = {
22
+ event: [
23
+ {
24
+ name: "on_click",
25
+ ef: "点击触发",
26
+ params: "-"
27
+ }
28
+ ]
29
+ },
30
+ init_data = `{
31
+ btnText: "按钮文字",
32
+ /* btnColor: {
33
+ normal: {
34
+ text: "默认文字色样式色值",
35
+ bg: "默认背景色样式色值",
36
+ line: "默认描边色样式色值",
37
+ },
38
+ hover: {
39
+ text: "悬停文字色样式色值",
40
+ bg: "悬停背景色样式色值",
41
+ line: "悬停描边色样式色值",
42
+ },
43
+ } */,
44
+ /* btnRound: "启用大圆角效果" */,
45
+ /* btnWidth: "按钮固定宽度" */,
46
+ /* hotData: "(参照:b-hot 组件入参)" */,
47
+ /* iconData: "(参照:b-icon 组件入参)" */
48
+ }`;
49
+
50
+ export default {
51
+ name: "btn-wid",
52
+ introduce: { desc, extend, dependent, api, init_data },
53
+ components: {
54
+ BHot,
55
+ BIcon
56
+ },
57
+ props: {
58
+ btnText: {
59
+ type: String,
60
+ required: true,
61
+ },
62
+ btnColor: {
63
+ type: Object,
64
+ required: false,
65
+ default: () => {
66
+ return {
67
+ normal:{},
68
+ hover:{},
69
+ }
70
+ }
71
+ },
72
+ btnRound: {
73
+ type: Boolean,
74
+ required: false
75
+ },
76
+ btnWidth: {
77
+ type: [String, Number],
78
+ required: false
79
+ },
80
+ hotData: {
81
+ type: Object,
82
+ required: false
83
+ },
84
+ iconData: {
85
+ type: Object,
86
+ required: false
87
+ }
88
+ },
89
+ data(){
90
+ return {
91
+
92
+ //按钮色彩风格
93
+ btn_color: {
94
+ normal: {
95
+ text: "dgray",
96
+ bg: "lgray",
97
+ line: "none",
98
+ ...this.btnColor.normal
99
+ },
100
+ hover: {
101
+ text: "blue",
102
+ bg: "#e7e7e7",
103
+ line: "none",
104
+ ...this.btnColor.hover
105
+ }
106
+ }
107
+
108
+ }
109
+ },
110
+ methods: {
111
+
112
+ //执行点击
113
+ $_click(){
114
+ this.$emit("on_click");
115
+ },
116
+
117
+ //设置背景样式
118
+ $_set_bg(color){
119
+ if(Array.isArray(color)){ //渐变色
120
+ return `bg-gradient-left,${color.join(",")}`;
121
+ }else{ //纯色
122
+ return `bg-color-${color}`;
123
+ }
124
+ }
125
+
126
+ }
127
+ }
128
+ </script>
@@ -0,0 +1,138 @@
1
+ <template>
2
+ <b-view styles="no-scroll"
3
+ @on_touchstart="pause"
4
+ @on_touchend="play"
5
+ @on_leave="play"
6
+ @on_enter="pause">
7
+ <b-view styles="flex"
8
+ :dynamic="`w-${item_box_width}px translateX-f${offset}px`">
9
+ <b-view v-for="(item,i) of play_items" :key="i"
10
+ :styles="`pad-h-${rule / 2}px`"
11
+ :dynamic="`w-${item_width}px`">
12
+ <slot :name="item.id" />
13
+ </b-view>
14
+ </b-view>
15
+ </b-view>
16
+ </template>
17
+
18
+ <script>
19
+ import BView from "@/components/BTXUI/core/b-view"
20
+
21
+ const desc = ["该组件用于实现自定义元素的走马灯效果。"],
22
+ extend = [],
23
+ dependent = ["b-view"],
24
+ api = {
25
+ methods: [
26
+ {
27
+ name: "play",
28
+ ef: "播放走马灯",
29
+ params: "-",
30
+ return: "-"
31
+ },
32
+ {
33
+ name: "pause",
34
+ ef: "暂停走马灯",
35
+ params: "-",
36
+ return: "-"
37
+ }
38
+ ]
39
+ },
40
+ init_data = `{
41
+ items: [
42
+ {
43
+ id: "数据标识",...
44
+ },...
45
+ ],
46
+ /* visiableCount: "项目可见数量,默认为 3" */,
47
+ /* rule: "项目间距" */,
48
+ /* speed: "播放速度" */
49
+ }`;
50
+
51
+ export default {
52
+ name: "carousel-wid",
53
+ introduce: { desc, extend, dependent, api, init_data },
54
+ components: {
55
+ BView
56
+ },
57
+ props: {
58
+ items: {
59
+ required: true,
60
+ type: Array
61
+ },
62
+ visiableCount: {
63
+ required: false,
64
+ type: Number,
65
+ default: 3
66
+ },
67
+ rule: {
68
+ required: false,
69
+ type: Number,
70
+ default: 0
71
+ },
72
+ speed: {
73
+ required: false,
74
+ type: Number,
75
+ default: 1
76
+ },
77
+ },
78
+ data(){
79
+ return {
80
+
81
+ //播放项目
82
+ play_items: this.items,
83
+
84
+ //播放器宽度
85
+ player_width: 0,
86
+
87
+ //项目宽度
88
+ item_width: 0,
89
+
90
+ //项目容器宽度
91
+ item_box_width: 0,
92
+
93
+ //播放状态
94
+ play_state: true,
95
+
96
+ //水平位移
97
+ offset: 0,
98
+
99
+ }
100
+ },
101
+ methods: {
102
+
103
+ //暂停
104
+ pause(){
105
+ this.play_state = false;
106
+ },
107
+
108
+ //播放
109
+ play(){
110
+ this.play_state = true;
111
+ this.$_play();
112
+ },
113
+
114
+ //执行播放
115
+ $_play(){
116
+ if(!this.play_state) return false;
117
+ let speed = this.offset += this.speed;
118
+ if(speed >= this.item_width){
119
+ this.play_items.push(this.play_items.shift());
120
+ this.offset = 0;
121
+ }
122
+ requestAnimationFrame(this.$_play);
123
+ },
124
+
125
+ //初始化数据
126
+ $_init_data(){
127
+ this.player_width = this.$el.clientWidth;
128
+ this.item_width = this.player_width / this.visiableCount;
129
+ this.item_box_width = this.item_width * this.play_items.length;
130
+ this.play_items.length > this.visiableCount && this.$_play();
131
+ },
132
+
133
+ },
134
+ mounted(){
135
+ this.$_init_data();
136
+ }
137
+ }
138
+ </script>
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <b-hot :styles="`flex-4 bg-color-neutral round-sm ${tag_text? 'pad-r-1 pad-v-.4 pad-l-.4': ''}`"
3
+ hover="bg-color-rgba(134,134,134,.24)"
4
+ :states="{
5
+ act: {
6
+ style: 'color-blue',
7
+ state: selected
8
+ }
9
+ }"
10
+ @on_click="$_click">
11
+
12
+ <!--选框-->
13
+ <b-view styles="w-1.7 h-1.7 bg-color-neutral round-sm flex-5"
14
+ :states="{
15
+ act: {
16
+ style: 'bg-color-blue color-light',
17
+ state: selected
18
+ }
19
+ }">
20
+ <b-icon icon="success" styles="alpha-.3"
21
+ :states="{
22
+ act: {
23
+ style: 'alpha-1',
24
+ state: selected
25
+ }
26
+ }"/>
27
+ </b-view>
28
+
29
+ <!--文字-->
30
+ <b-view v-if="tag_text" styles="mrg-l-1 ellipsis">
31
+ {{tag_text}}
32
+ </b-view>
33
+
34
+ </b-hot>
35
+ </template>
36
+
37
+ <script>
38
+ import TagWid from "@/components/BTXUI/tag/tag-wid"
39
+ import BHot from "@/components/BTXUI/core/b-hot"
40
+ import BView from "@/components/BTXUI/core/b-view"
41
+ import BIcon from "@/components/BTXUI/core/b-icon"
42
+
43
+ let desc = ["该组件用于复选框切换选择操作。"],
44
+ extend = ["tag-wid"],
45
+ dependent = ["b-hot", "b-icon", "b-view"],
46
+ api = {
47
+ extend: "继承自:<code>tag-wid</code> 组件"
48
+ },
49
+ init_data = "继承自:tag-wid 组件入参。text 为非必须参数,colors、mode 入参无效";
50
+
51
+ export default {
52
+ extends: TagWid,
53
+ name: "checkbox-wid",
54
+ introduce: { desc, extend, dependent, api, init_data },
55
+ components: {
56
+ BView,
57
+ BHot,
58
+ BIcon
59
+ },
60
+ props: {
61
+ text: {
62
+ type: String,
63
+ required: false
64
+ },
65
+ mode: {
66
+ type: String,
67
+ required: false,
68
+ default: "checkbox"
69
+ },
70
+ }
71
+ }
72
+ </script>
@@ -0,0 +1,279 @@
1
+ <template>
2
+ <pannel-wid v-model="visible" v-bind="pannel_data">
3
+ <b-view :styles="`round-sm pcenter fsize-1.1 shadow color-rgba(24,24,24,.34) bg-color-${wid_colors.pannel}`">
4
+ <b-view :styles="`flex-column flex-5 pad-v-2.5 pad-h-4 color-${wid_colors.text}`">
5
+ <!--图标-->
6
+ <b-view styles="mrg-b-1 flex-2" v-if="pannel.state">
7
+ <b-view styles="w-3.2 h-3.2 round fsize-1.7 flex-5"
8
+ :states="{
9
+ success: {
10
+ style: `bg-color-${wid_colors.success}`,
11
+ state: pannel.state === 'success'
12
+ },
13
+ fail: {
14
+ style: `bg-color-${wid_colors.fail}`,
15
+ state: pannel.state === 'fail'
16
+ },
17
+ notic: {
18
+ style: `bg-color-${wid_colors.notic}`,
19
+ state: pannel.state === 'notic'
20
+ },
21
+ loading: {
22
+ style: `bg-color-${wid_colors.loading}`,
23
+ state: pannel.state === 'loading'
24
+ },
25
+ }">
26
+ <b-icon :icon="pannel_icon" />
27
+ </b-view>
28
+ </b-view>
29
+
30
+ <!--文字-->
31
+ <b-view styles="alpha-.9" v-html="pannel.text"></b-view>
32
+ </b-view>
33
+
34
+ <!--按钮-->
35
+ <b-view v-if="pannel.mode !== 'toast'" :styles="`flex pad-3px color-${wid_colors.text}`">
36
+ <!--alert-->
37
+ <template v-if="pannel.mode === 'alert'">
38
+ <b-hot key="a" @on_click="$_close()"
39
+ styles="bg-color-neutral round-sm pad-h-1.2 pad-v-.7 grow-1"
40
+ hover="bg-color-rgba(134,134,134,0.24)">
41
+ {{btn_cname[0]}}
42
+ </b-hot>
43
+ </template>
44
+
45
+ <!--confirm-->
46
+ <template v-else-if="pannel.mode === 'confirm'">
47
+ <b-hot key="b" @on_click="$_click('ok')"
48
+ styles="bg-color-neutral round-sm round-l pad-h-1.2 pad-v-.7 grow-1 mrg-r-1px"
49
+ hover="bg-color-rgba(134,134,134,0.24)">
50
+ {{btn_cname[0]}}
51
+ </b-hot>
52
+ <b-hot @on_click="$_click('cancel')"
53
+ styles="bg-color-neutral round-sm round-r pad-h-1.2 pad-v-.7 grow-1"
54
+ hover="bg-color-rgba(134,134,134,0.24)">
55
+ {{btn_cname[1]}}
56
+ </b-hot>
57
+ </template>
58
+ </b-view>
59
+ </b-view>
60
+ </pannel-wid>
61
+ </template>
62
+
63
+ <script>
64
+ import BView from "@/components/BTXUI/core/b-view";
65
+ import BHot from "@/components/BTXUI/core/b-hot";
66
+ import BIcon from "@/components/BTXUI/core/b-icon";
67
+ import PannelWid from "@/components/BTXUI/pannel/pannel-wid";
68
+
69
+ const desc = ["该组件用于显示弹窗提示。", "通常在入口页进行全局实例化绑定,之后可通过相关 API 进行使用:<code>this.$confirm['method']()</code>。"],
70
+ extend = [],
71
+ dependent = ["pannel-wid", "b-icon", "b-hot", "b-view"],
72
+ api = {
73
+ methods: [
74
+ {
75
+ name: "toast",
76
+ ef: "显示提示弹窗",
77
+ params: "text, <span class=\"alpha-d7\">[duration=2000, state=\"\"]</span>",
78
+ return: "-"
79
+ },
80
+ {
81
+ name: "alert",
82
+ ef: "显示警示弹窗",
83
+ params: "text, <span class=\"alpha-d7\">[state=\"\", btn_cname=\"确认\"]</span>",
84
+ return: "-"
85
+ },
86
+ {
87
+ name: "confirm",
88
+ ef: "显示确认弹窗",
89
+ params: "text, <span class=\"alpha-d7\">[success=null, error=null, state=\"\", btn_cname=[\"确认,取消\"]]</span>",
90
+ return: "-"
91
+ },
92
+ {
93
+ name: "prograss",
94
+ ef: "显示加载弹窗",
95
+ params: "text, <span class=\"alpha-d7\">[result=false]</span>",
96
+ return: "-"
97
+ }
98
+ ]
99
+ },
100
+ init_data = `{
101
+ /* colors: {
102
+ matte: "遮罩颜色",
103
+ text: "文字颜色(同时支持富文本)",
104
+ pannel: "面板颜色",
105
+ suucees: "成功提示图标背景色",
106
+ fail: "失败提示图标背景色",
107
+ notic: "信息提示图标背景色",
108
+ loading: "加载提示图标背景色"
109
+ } */
110
+ }`;
111
+
112
+ export default {
113
+ name: "confirm-wid",
114
+ introduce: { desc, extend, dependent, api, init_data },
115
+ components: {
116
+ PannelWid,
117
+ BView,
118
+ BHot,
119
+ BIcon
120
+ },
121
+ props: {
122
+ colors: {
123
+ type: Object,
124
+ required: false
125
+ },
126
+ },
127
+ data() {
128
+ return {
129
+
130
+ //组件配色
131
+ wid_colors: {
132
+ text: "dgray",
133
+ pannel: "light",
134
+ success: "#e6fff2",
135
+ fail: "#f9f2f4",
136
+ notic: "#e6f5ff",
137
+ loading: "lgray",
138
+ ...this.colors
139
+ },
140
+
141
+ //pannel-wid 入参
142
+ pannel_data: {
143
+ matte: true,
144
+ matteColor: this.colors.matte,
145
+ matteZIndex: 10
146
+ },
147
+
148
+ //弹窗显示状态
149
+ visible: false,
150
+
151
+ //弹窗状态
152
+ pannel: {
153
+ mode: "",
154
+ text: "",
155
+ state: "",
156
+ close_t: null,
157
+ },
158
+
159
+ //按钮别名
160
+ btn_cname: null,
161
+
162
+ //点击回调
163
+ callbacks: {
164
+ ok: null,
165
+ cancel: null
166
+ },
167
+
168
+ }
169
+ },
170
+ computed: {
171
+
172
+ //面板图标
173
+ pannel_icon(){
174
+ let state = this.pannel.state;
175
+ return (state === "success" || state === "fail" || state === "notic" || state === "loading")? `ani_${state}`: state;
176
+ }
177
+
178
+ },
179
+ methods: {
180
+
181
+ //提示弹窗
182
+ toast(text, duration=2000, state="") {
183
+ this.$_show();
184
+ this.pannel = {
185
+ mode: "toast",
186
+ state,
187
+ text
188
+ }
189
+ setTimeout(() => {
190
+ this.$_close();
191
+ }, duration)
192
+ },
193
+
194
+ //警示弹窗
195
+ alert(text, state="", btn_cname="确认") {
196
+ this.$_show();
197
+ this.pannel = {
198
+ mode: "alert",
199
+ state,
200
+ text
201
+ }
202
+ this.btn_cname = [btn_cname];
203
+ this.$_bind_keyboard_event();
204
+ },
205
+
206
+ //确认弹窗
207
+ confirm(text, success=null, error=null, state="", btn_cname=["确认","取消"]) {
208
+ this.$_show();
209
+ this.pannel = {
210
+ mode: "confirm",
211
+ text,
212
+ state
213
+ }
214
+ this.btn_cname = btn_cname;
215
+ this.callbacks.ok = success;
216
+ this.callbacks.cancel = error;
217
+ this.$_bind_keyboard_event();
218
+ },
219
+
220
+ //加载弹窗
221
+ prograss(text, result=false) {
222
+ if(result === true){ //直接关闭
223
+ this.toast("", 0);
224
+ } else if(typeof(result) === "string") { //状态关闭
225
+ this.toast(text, 2000, result);
226
+ } else { //开启弹窗
227
+ this.$_show();
228
+ this.pannel = {
229
+ mode: "toast",
230
+ state: "loading",
231
+ text
232
+ }
233
+ }
234
+ },
235
+
236
+ //关闭窗口
237
+ $_close(callback) {
238
+ callback && callback();
239
+ this.visible = false;
240
+ this.$_cancel_bind_keyboard_event();
241
+ },
242
+
243
+ //显示窗口
244
+ $_show() {
245
+ this.visible = true;
246
+ },
247
+
248
+ //执行点击操作
249
+ $_click(operate) {
250
+ this.$_close(this.callbacks[operate]);
251
+ },
252
+
253
+ //绑定键盘事件
254
+ $_bind_keyboard_event() {
255
+ window.focus();
256
+ window.addEventListener("keyup", this.$_keyboard_enter);
257
+ },
258
+
259
+ //回车输入
260
+ $_keyboard_enter(e) {
261
+ if (e.key === "Enter") {
262
+ this.$_close(this.callbacks.ok);
263
+ }
264
+ },
265
+
266
+ //销毁键盘事件
267
+ $_cancel_bind_keyboard_event() {
268
+ window.removeEventListener("keyup", this.$_keyboard_enter);
269
+ }
270
+
271
+ },
272
+ mounted() {
273
+ // this.$root.__proto__.$confirm = this; // 扩展为全局工具组件
274
+ },
275
+ beforeDestroy() {
276
+ this.$_close();
277
+ }
278
+ }
279
+ </script>
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <b-hot :styles="`flex-4 bg-color-neutral round-sm ${tag_text? 'pad-r-1 pad-v-.4 pad-l-.4': ''} color-${tag_colors.normal.text} bg-color-${tag_colors.normal.bg}`"
3
+ :hover="`bg-color-${tag_colors.hover.bg} color-${tag_colors.hover.text}`"
4
+ :states="{
5
+ act: {
6
+ style: `bg-color-${tag_colors.act.bg} color-${tag_colors.act.text}`,
7
+ state: selected
8
+ }
9
+ }"
10
+ @on_click="$_click">
11
+
12
+ <!--选框-->
13
+ <b-view styles="w-1.7 h-1.7 bg-color-neutral round-sm flex-5"
14
+ :states="{
15
+ act: {
16
+ style: `bg-color-${tag_colors.act.text} color-${tag_colors.act.bg}`,
17
+ state: selected
18
+ }
19
+ }">
20
+ <b-icon icon="success" styles="alpha-.3"
21
+ :states="{
22
+ act: {
23
+ style: 'alpha-1',
24
+ state: selected
25
+ }
26
+ }"/>
27
+ </b-view>
28
+
29
+ <!--文字-->
30
+ <b-view v-if="tag_text" styles="mrg-l-1">
31
+ {{tag_text}}
32
+ </b-view>
33
+
34
+ </b-hot>
35
+ </template>
36
+
37
+ <script>
38
+ import CheckboxWid from "@/components/BTXUI/checkbox/checkbox-wid"
39
+
40
+ export default {
41
+ extends: CheckboxWid,
42
+ name: "content-checkbox-wid"
43
+ }
44
+ </script>