bulade-ui 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/miniprogram_dist/bld-action-sheet/index.js +196 -0
  2. package/miniprogram_dist/bld-action-sheet/index.js.map +1 -0
  3. package/miniprogram_dist/bld-action-sheet/index.json +8 -0
  4. package/miniprogram_dist/bld-action-sheet/index.wxml +57 -0
  5. package/miniprogram_dist/bld-action-sheet/index.wxss +160 -0
  6. package/miniprogram_dist/bld-badge/index.js +156 -0
  7. package/miniprogram_dist/bld-badge/index.js.map +1 -0
  8. package/miniprogram_dist/bld-badge/index.json +4 -0
  9. package/miniprogram_dist/bld-badge/index.wxml +14 -0
  10. package/miniprogram_dist/bld-badge/index.wxss +43 -0
  11. package/miniprogram_dist/bld-button/index.wxml +0 -1
  12. package/miniprogram_dist/bld-drawer/index.js +2 -2
  13. package/miniprogram_dist/bld-drawer/index.js.map +1 -1
  14. package/miniprogram_dist/bld-drawer/index.wxss +4 -3
  15. package/miniprogram_dist/bld-empty-page/index.js +123 -0
  16. package/miniprogram_dist/bld-empty-page/index.js.map +1 -0
  17. package/miniprogram_dist/bld-empty-page/index.json +3 -0
  18. package/miniprogram_dist/bld-empty-page/index.wxml +11 -0
  19. package/miniprogram_dist/bld-empty-page/index.wxss +14 -0
  20. package/miniprogram_dist/bld-message/index.js +2 -2
  21. package/miniprogram_dist/bld-message/index.js.map +1 -1
  22. package/miniprogram_dist/bld-message/message.js +2 -2
  23. package/miniprogram_dist/bld-message/message.js.map +1 -1
  24. package/miniprogram_dist/bld-modal/index.js +223 -0
  25. package/miniprogram_dist/bld-modal/index.js.map +1 -0
  26. package/miniprogram_dist/bld-modal/index.json +6 -0
  27. package/miniprogram_dist/bld-modal/index.wxml +23 -0
  28. package/miniprogram_dist/bld-modal/index.wxss +97 -0
  29. package/miniprogram_dist/bld-modal/modal.js +147 -0
  30. package/miniprogram_dist/bld-modal/modal.js.map +1 -0
  31. package/miniprogram_dist/bld-navbar/index.js +167 -0
  32. package/miniprogram_dist/bld-navbar/index.js.map +1 -0
  33. package/miniprogram_dist/bld-navbar/index.json +6 -0
  34. package/miniprogram_dist/bld-navbar/index.wxml +8 -0
  35. package/miniprogram_dist/bld-navbar/index.wxss +31 -0
  36. package/miniprogram_dist/bld-navbar-group/index.js +243 -0
  37. package/miniprogram_dist/bld-navbar-group/index.js.map +1 -0
  38. package/miniprogram_dist/bld-navbar-group/index.json +4 -0
  39. package/miniprogram_dist/bld-navbar-group/index.wxml +37 -0
  40. package/miniprogram_dist/bld-navbar-group/index.wxss +30 -0
  41. package/miniprogram_dist/bld-pop-up/index.js +129 -0
  42. package/miniprogram_dist/bld-pop-up/index.js.map +1 -0
  43. package/miniprogram_dist/bld-pop-up/index.json +6 -0
  44. package/miniprogram_dist/bld-pop-up/index.wxml +18 -0
  45. package/miniprogram_dist/bld-pop-up/index.wxss +27 -0
  46. package/miniprogram_dist/bld-tag/index.js +134 -0
  47. package/miniprogram_dist/bld-tag/index.js.map +1 -0
  48. package/miniprogram_dist/bld-tag/index.json +3 -0
  49. package/miniprogram_dist/bld-tag/index.wxml +3 -0
  50. package/miniprogram_dist/bld-tag/index.wxss +108 -0
  51. package/miniprogram_dist/bld-toast/index.js +2 -2
  52. package/miniprogram_dist/bld-toast/index.js.map +1 -1
  53. package/miniprogram_dist/bld-toast/toast.js +2 -2
  54. package/miniprogram_dist/bld-toast/toast.js.map +1 -1
  55. package/miniprogram_dist/cell/index.js +2 -2
  56. package/miniprogram_dist/cell/index.js.map +1 -1
  57. package/miniprogram_dist/cell-group/index.js +2 -2
  58. package/miniprogram_dist/cell-group/index.js.map +1 -1
  59. package/miniprogram_dist/grid/index.js +2 -2
  60. package/miniprogram_dist/grid/index.js.map +1 -1
  61. package/miniprogram_dist/grid-item/index.js +2 -2
  62. package/miniprogram_dist/grid-item/index.js.map +1 -1
  63. package/miniprogram_dist/icon/index.js +2 -2
  64. package/miniprogram_dist/icon/index.js.map +1 -1
  65. package/miniprogram_dist/timeline/index.js +2 -2
  66. package/miniprogram_dist/timeline/index.js.map +1 -1
  67. package/miniprogram_dist/timeline-item/index.js +2 -2
  68. package/miniprogram_dist/timeline-item/index.js.map +1 -1
  69. package/package.json +1 -1
  70. package/src/bld-action-sheet/index.js +83 -0
  71. package/src/bld-action-sheet/index.json +8 -0
  72. package/src/bld-action-sheet/index.scss +180 -0
  73. package/src/bld-action-sheet/index.wxml +57 -0
  74. package/src/bld-action-sheet/index.wxss +160 -0
  75. package/src/bld-badge/index.js +53 -0
  76. package/src/bld-badge/index.json +4 -0
  77. package/src/bld-badge/index.scss +46 -0
  78. package/src/bld-badge/index.wxml +14 -0
  79. package/src/bld-badge/index.wxss +43 -0
  80. package/src/bld-button/index.wxml +0 -1
  81. package/src/bld-content-container/index.js +46 -0
  82. package/src/bld-content-container/index.json +3 -0
  83. package/src/bld-content-container/index.scss +0 -0
  84. package/src/bld-content-container/index.wxml +5 -0
  85. package/src/bld-content-container/index.wxss +0 -0
  86. package/src/bld-drawer/index.scss +8 -3
  87. package/src/bld-drawer/index.wxss +4 -3
  88. package/src/bld-empty-page/index.js +23 -0
  89. package/src/bld-empty-page/index.json +3 -0
  90. package/src/bld-empty-page/index.scss +15 -0
  91. package/src/bld-empty-page/index.wxml +11 -0
  92. package/src/bld-empty-page/index.wxss +14 -0
  93. package/src/bld-modal/index.js +123 -0
  94. package/src/bld-modal/index.json +6 -0
  95. package/src/bld-modal/index.scss +108 -0
  96. package/src/bld-modal/index.wxml +23 -0
  97. package/src/bld-modal/index.wxss +97 -0
  98. package/src/bld-modal/modal.js +38 -0
  99. package/src/bld-navbar/index.js +63 -0
  100. package/src/bld-navbar/index.json +6 -0
  101. package/src/bld-navbar/index.scss +35 -0
  102. package/src/bld-navbar/index.wxml +8 -0
  103. package/src/bld-navbar/index.wxss +31 -0
  104. package/src/bld-navbar-group/index.js +139 -0
  105. package/src/bld-navbar-group/index.json +4 -0
  106. package/src/bld-navbar-group/index.scss +33 -0
  107. package/src/bld-navbar-group/index.wxml +37 -0
  108. package/src/bld-navbar-group/index.wxss +30 -0
  109. package/src/bld-pop-up/index.js +29 -0
  110. package/src/bld-pop-up/index.json +6 -0
  111. package/src/bld-pop-up/index.scss +27 -0
  112. package/src/bld-pop-up/index.wxml +18 -0
  113. package/src/bld-pop-up/index.wxss +27 -0
  114. package/src/bld-tag/index.js +34 -0
  115. package/src/bld-tag/index.json +3 -0
  116. package/src/bld-tag/index.scss +127 -0
  117. package/src/bld-tag/index.wxml +3 -0
  118. package/src/bld-tag/index.wxss +108 -0
@@ -0,0 +1,5 @@
1
+ <view
2
+ class="content-container iclass"
3
+ style="{{ style }}">
4
+ <slot />
5
+ </view>
File without changes
@@ -24,7 +24,8 @@
24
24
  right: 0;
25
25
  bottom: 0;
26
26
  background-color: var(--color-mask, rgba(0, 0, 0, 0.55));
27
- transition: opacity .25s ease-in-out, visibility .25s ease-in-out;
27
+ // transition: opacity .25s ease-in-out, visibility .25s ease-in-out;
28
+ transition: all 200ms ease;
28
29
  }
29
30
 
30
31
  .m-drawer__content {
@@ -33,7 +34,9 @@
33
34
  position: fixed;
34
35
  transform-origin: center;
35
36
  background-color: #fff;
36
- transition: transform .25s ease-in-out, opacity .25s ease-in-out, visibility .25s ease-in-out;
37
+ // transition: transform .25s ease-in-out, opacity .25s ease-in-out, visibility .25s ease-in-out;
38
+ transition: all 300ms ease;
39
+ border-radius:20rpx;
37
40
  }
38
41
 
39
42
  &.m-drawer--left {
@@ -41,6 +44,7 @@
41
44
  top: 0;
42
45
  left: 0;
43
46
  transform: translate3d(-100%, 0, 0);
47
+
44
48
  }
45
49
  }
46
50
 
@@ -66,7 +70,8 @@
66
70
  left: 0;
67
71
  bottom: 0;
68
72
  width: 100%;
69
- transform: translate3d(0, 100%, 0);
73
+ // transform: translate3d(0, 100%, 0);
74
+ transform: scale(1) translate3d(0, 100%, 0);
70
75
  padding-bottom: constant(safe-area-inset-bottom);
71
76
  padding-bottom: env(safe-area-inset-bottom);
72
77
  }
@@ -21,7 +21,7 @@
21
21
  right: 0;
22
22
  bottom: 0;
23
23
  background-color: var(--color-mask, rgba(0, 0, 0, 0.55));
24
- transition: opacity 0.25s ease-in-out, visibility 0.25s ease-in-out;
24
+ transition: all 200ms ease;
25
25
  }
26
26
  .m-drawer .m-drawer__content {
27
27
  opacity: 0;
@@ -29,7 +29,8 @@
29
29
  position: fixed;
30
30
  transform-origin: center;
31
31
  background-color: #fff;
32
- transition: transform 0.25s ease-in-out, opacity 0.25s ease-in-out, visibility 0.25s ease-in-out;
32
+ transition: all 300ms ease;
33
+ border-radius: 20rpx;
33
34
  }
34
35
  .m-drawer.m-drawer--left .m-drawer__content {
35
36
  top: 0;
@@ -51,7 +52,7 @@
51
52
  left: 0;
52
53
  bottom: 0;
53
54
  width: 100%;
54
- transform: translate3d(0, 100%, 0);
55
+ transform: scale(1) translate3d(0, 100%, 0);
55
56
  padding-bottom: constant(safe-area-inset-bottom);
56
57
  padding-bottom: env(safe-area-inset-bottom);
57
58
  }
@@ -0,0 +1,23 @@
1
+ const app = getApp();
2
+
3
+ Component({
4
+ externalClasses: ["iclass"],
5
+ properties: {
6
+ content: {
7
+ type: String,
8
+ value: "这里什么都没有",
9
+ },
10
+ imageSrc: {
11
+ type: String,
12
+ value: "empty/empty-default.png",
13
+ },
14
+ padding: {
15
+ type: String,
16
+ value: "40% 0",
17
+ },
18
+ showImage: {
19
+ type: Boolean,
20
+ value: true,
21
+ },
22
+ },
23
+ });
@@ -0,0 +1,3 @@
1
+ {
2
+ "component": true
3
+ }
@@ -0,0 +1,15 @@
1
+ .empty {
2
+ display: flex;
3
+ align-items: center;
4
+ flex-direction: column;
5
+ justify-content: center;
6
+
7
+ font-weight: 400;
8
+ color: #a3a3a3;
9
+ .img {
10
+ height: 300rpx;
11
+ width: 300rpx;
12
+ margin-bottom: 32rpx;
13
+ background: none;
14
+ }
15
+ }
@@ -0,0 +1,11 @@
1
+ <view
2
+ class="empty iclass"
3
+ style="padding: {{ padding }}"
4
+ >
5
+ <cloud-image
6
+ wx:if="{{ showImage }}"
7
+ iclass="img iclass"
8
+ src="{{ imageSrc }}"
9
+ />
10
+ <text>{{ content }}</text>
11
+ </view>
@@ -0,0 +1,14 @@
1
+ .empty {
2
+ display: flex;
3
+ align-items: center;
4
+ flex-direction: column;
5
+ justify-content: center;
6
+ font-weight: 400;
7
+ color: #a3a3a3;
8
+ }
9
+ .empty .img {
10
+ height: 300rpx;
11
+ width: 300rpx;
12
+ margin-bottom: 32rpx;
13
+ background: none;
14
+ }
@@ -0,0 +1,123 @@
1
+ Component({
2
+ externalClasses: ['custom-class', 'custom-mask-class', 'custom-body-class'],
3
+
4
+ options: {
5
+ addGlobalClass: true,
6
+ },
7
+
8
+ properties: {
9
+ visible: {
10
+ type: Boolean,
11
+ value: false
12
+ },
13
+ title: {
14
+ type: String,
15
+ value: ''
16
+ },
17
+ content: {
18
+ type: String,
19
+ value: ''
20
+ },
21
+ closeOnClickModal: {
22
+ type: Boolean,
23
+ value: true
24
+ },
25
+ showConfirmButton: {
26
+ type: Boolean,
27
+ value: true
28
+ },
29
+ showCancelButton: {
30
+ type: Boolean,
31
+ value: true
32
+ },
33
+ confirmButtonText: {
34
+ type: String,
35
+ value: '确定'
36
+ },
37
+ cancelButtonText: {
38
+ type: String,
39
+ value: '取消'
40
+ },
41
+ confirmTextColor: {
42
+ type: String,
43
+ value: '#409EFF'
44
+ },
45
+ loading: {
46
+ type: Boolean,
47
+ value: false
48
+ },
49
+ asyncClose: {
50
+ type: Boolean,
51
+ value: false
52
+ }
53
+ },
54
+
55
+ methods: {
56
+ _reset() {
57
+ this.setData({
58
+ title: '',
59
+ content: '',
60
+ showConfirmButton: true,
61
+ showCancelButton: true,
62
+ confirmButtonText: '确定',
63
+ cancelButtonText: '取消',
64
+ confirmTextColor: '#409EFF',
65
+ loading: false,
66
+ asyncClose: false
67
+ })
68
+ },
69
+
70
+ // 确定
71
+ onConfirm() {
72
+ // 异步
73
+ if (this.data.asyncClose) {
74
+ this.setData({
75
+ loading: true
76
+ })
77
+ if (this._confirm) {
78
+ this._confirm()
79
+ }
80
+ } else {
81
+ if (this._confirm) {
82
+ this.close()
83
+ }
84
+ }
85
+ this.triggerEvent('confirm')
86
+ },
87
+
88
+ onCancel() {
89
+ if (this.data.loading) return
90
+
91
+ this.setData({
92
+ visible: false
93
+ })
94
+ this.triggerEvent('cancel')
95
+
96
+ if (this._cancel) {
97
+ this._cancel()
98
+ this.close()
99
+ }
100
+ },
101
+
102
+ onMaskClick() {
103
+ if (!this.data.closeOnClickModal) return;
104
+ this.close()
105
+ },
106
+
107
+ _show(options) {
108
+ this.setData({
109
+ ...options,
110
+ visible: true
111
+ })
112
+ },
113
+
114
+ // 关闭并重置默认参数
115
+ close() {
116
+ this.setData({
117
+ visible: false
118
+ })
119
+
120
+ this.triggerEvent('close')
121
+ }
122
+ }
123
+ })
@@ -0,0 +1,6 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {
4
+ "m-button": "../button/index"
5
+ }
6
+ }
@@ -0,0 +1,108 @@
1
+ .m-mask {
2
+ z-index: 1000;
3
+ position: fixed;
4
+ top: 0;
5
+ left: 0;
6
+ right: 0;
7
+ bottom: 0;
8
+ opacity: 1;
9
+ visibility: visible;
10
+ background: var(--color-mask, rgba(0, 0, 0, 0.55));
11
+ transition: all 0.25s ease-in-out;
12
+
13
+ &.is-hidden {
14
+ opacity: 0;
15
+ visibility: hidden;
16
+ }
17
+ }
18
+
19
+ .m-modal-wrap {
20
+ z-index: 1001;
21
+ position: fixed;
22
+ left: 50%;
23
+ top: 50%;
24
+ visibility: visible;
25
+ transform: translate3d(-50%, -50%, 0);
26
+
27
+ &.is-hidden {
28
+ visibility: hidden;
29
+ }
30
+
31
+ .m-modal {
32
+ z-index: 9;
33
+ position: relative;
34
+ width: 540rpx;
35
+ transform: scale(.9);
36
+ opacity: 0;
37
+ transition: transform 0.2s ease-in-out, opacity .2s ease-in-out;
38
+
39
+ &.is-show {
40
+ opacity: 1;
41
+ transform: scale(1);
42
+ }
43
+
44
+ .m-modal__content {
45
+ position: relative;
46
+ padding-top: 30rpx;
47
+ height: 100%;
48
+ border: 0;
49
+ border-radius: 3rpx;
50
+ text-align: center;
51
+ background-color: #fff;
52
+ background-clip: padding-box;
53
+ overflow: hidden;
54
+ }
55
+
56
+ .m-modal__title {
57
+ margin: 0;
58
+ padding: 12rpx 30rpx 24rpx;
59
+ font-size: 36rpx;
60
+ line-height: 1;
61
+ color: #1c2438;
62
+ text-align: center;
63
+ }
64
+
65
+ .m-modal__body {
66
+ max-height: 300rpx;
67
+ margin-bottom: 30rpx;
68
+ padding: 20rpx 40rpx;
69
+ font-size: 28rpx;
70
+ color: #80848f;
71
+ line-height: 1.5;
72
+ overflow: auto;
73
+ -webkit-overflow-scrolling: touch;
74
+ }
75
+
76
+ .m-modal__btn-group {
77
+ position: relative;
78
+ display: flex;
79
+
80
+ &::after {
81
+ content: '';
82
+ position: absolute;
83
+ top: 0;
84
+ left: 0;
85
+ width: 100%;
86
+ height: 1px;
87
+ transform: scaleY(0.5);
88
+ background: #ddd;
89
+ }
90
+
91
+ .m-modal__btn {
92
+ position: relative;
93
+ flex: 1;
94
+
95
+ &.m-modal__btn--cancel::after {
96
+ content: '';
97
+ position: absolute;
98
+ top: 0;
99
+ right: 0;
100
+ width: 1px;
101
+ height: 100%;
102
+ transform: scaleX(0.5);
103
+ background: #ddd;
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
@@ -0,0 +1,23 @@
1
+ <view class="m-mask custom-mask-class {{ visible ? '' : 'is-hidden' }}" bindtap="onMaskClick"></view>
2
+
3
+ <view class="m-modal-wrap custom-class {{ visible ? '' : 'is-hidden' }}">
4
+ <view class="m-modal {{ visible ? 'is-show' : '' }}">
5
+ <view class="m-modal__content">
6
+ <view class="m-modal__title" wx:if="{{ title }}">{{ title }}</view>
7
+ <view class="m-modal__body custom-body-class" wx:if="{{ content }}">{{ content }}</view>
8
+ <view class="m-modal__body custom-body-class" wx:else>
9
+ <slot />
10
+ </view>
11
+ <view class="m-modal__btn-group">
12
+ <view class="m-modal__btn m-modal__btn--cancel" wx:if="{{ showCancelButton }}">
13
+ <m-button full type="ghost" bind:click="onCancel">{{ cancelButtonText }}</m-button>
14
+ </view>
15
+ <view class="m-modal__btn" wx:if="{{ showConfirmButton }}">
16
+ <m-button full type="ghost" loading="{{ loading }}" bind:click="onConfirm" color="{{ confirmTextColor }}">
17
+ {{ confirmButtonText }}
18
+ </m-button>
19
+ </view>
20
+ </view>
21
+ </view>
22
+ </view>
23
+ </view>
@@ -0,0 +1,97 @@
1
+ .m-mask {
2
+ z-index: 1000;
3
+ position: fixed;
4
+ top: 0;
5
+ left: 0;
6
+ right: 0;
7
+ bottom: 0;
8
+ opacity: 1;
9
+ visibility: visible;
10
+ background: var(--color-mask, rgba(0, 0, 0, 0.55));
11
+ transition: all 0.25s ease-in-out;
12
+ }
13
+ .m-mask.is-hidden {
14
+ opacity: 0;
15
+ visibility: hidden;
16
+ }
17
+
18
+ .m-modal-wrap {
19
+ z-index: 1001;
20
+ position: fixed;
21
+ left: 50%;
22
+ top: 50%;
23
+ visibility: visible;
24
+ transform: translate3d(-50%, -50%, 0);
25
+ }
26
+ .m-modal-wrap.is-hidden {
27
+ visibility: hidden;
28
+ }
29
+ .m-modal-wrap .m-modal {
30
+ z-index: 9;
31
+ position: relative;
32
+ width: 540rpx;
33
+ transform: scale(0.9);
34
+ opacity: 0;
35
+ transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
36
+ }
37
+ .m-modal-wrap .m-modal.is-show {
38
+ opacity: 1;
39
+ transform: scale(1);
40
+ }
41
+ .m-modal-wrap .m-modal .m-modal__content {
42
+ position: relative;
43
+ padding-top: 30rpx;
44
+ height: 100%;
45
+ border: 0;
46
+ border-radius: 3rpx;
47
+ text-align: center;
48
+ background-color: #fff;
49
+ background-clip: padding-box;
50
+ overflow: hidden;
51
+ }
52
+ .m-modal-wrap .m-modal .m-modal__title {
53
+ margin: 0;
54
+ padding: 12rpx 30rpx 24rpx;
55
+ font-size: 36rpx;
56
+ line-height: 1;
57
+ color: #1c2438;
58
+ text-align: center;
59
+ }
60
+ .m-modal-wrap .m-modal .m-modal__body {
61
+ max-height: 300rpx;
62
+ margin-bottom: 30rpx;
63
+ padding: 20rpx 40rpx;
64
+ font-size: 28rpx;
65
+ color: #80848f;
66
+ line-height: 1.5;
67
+ overflow: auto;
68
+ -webkit-overflow-scrolling: touch;
69
+ }
70
+ .m-modal-wrap .m-modal .m-modal__btn-group {
71
+ position: relative;
72
+ display: flex;
73
+ }
74
+ .m-modal-wrap .m-modal .m-modal__btn-group::after {
75
+ content: "";
76
+ position: absolute;
77
+ top: 0;
78
+ left: 0;
79
+ width: 100%;
80
+ height: 1px;
81
+ transform: scaleY(0.5);
82
+ background: #ddd;
83
+ }
84
+ .m-modal-wrap .m-modal .m-modal__btn-group .m-modal__btn {
85
+ position: relative;
86
+ flex: 1;
87
+ }
88
+ .m-modal-wrap .m-modal .m-modal__btn-group .m-modal__btn.m-modal__btn--cancel::after {
89
+ content: "";
90
+ position: absolute;
91
+ top: 0;
92
+ right: 0;
93
+ width: 1px;
94
+ height: 100%;
95
+ transform: scaleX(0.5);
96
+ background: #ddd;
97
+ }
@@ -0,0 +1,38 @@
1
+ function getCtx(selector) {
2
+ const pages = getCurrentPages()
3
+ const ctx = pages[pages.length - 1]
4
+ const componentCtx = ctx.selectComponent(selector)
5
+
6
+ if (!componentCtx) {
7
+ console.error('无法找到对应的组件,请按文档说明使用组件')
8
+ return null
9
+ }
10
+ return componentCtx
11
+ }
12
+
13
+ const Modal = options => {
14
+
15
+ return new Promise((resolve, reject) => {
16
+ const { selector = '#modal' } = options
17
+ const modal = getCtx(selector)
18
+ modal._reset()
19
+
20
+ modal._confirm = resolve
21
+ modal._cancel = reject
22
+ modal._show(options)
23
+
24
+ return modal
25
+ })
26
+ }
27
+
28
+ Modal.alert = options => Modal(Object.assign({
29
+ showCancelButton: false
30
+ }, options))
31
+ Modal.confirm = options => Modal(options)
32
+
33
+ Modal.close = (selector = '#modal') => {
34
+ const ctx = getCtx(selector)
35
+ ctx.close()
36
+ }
37
+
38
+ export default Modal
@@ -0,0 +1,63 @@
1
+ Component({
2
+ externalClasses: ['custom-class'],
3
+
4
+ options: {
5
+ addGlobalClass: true,
6
+ },
7
+
8
+ relations: {
9
+ '../bld-navbar-group/index': {
10
+ type: 'parent',
11
+ linked(target) {
12
+ this.parent = target
13
+ },
14
+ unlinked() {
15
+ this.parent = null
16
+ }
17
+ }
18
+ },
19
+
20
+ properties: {
21
+ name: {
22
+ type: String,
23
+ value: ''
24
+ },
25
+ title: {
26
+ type: String,
27
+ value: ''
28
+ },
29
+ value: {
30
+ type: String,
31
+ optionalTypes: [Number, String],
32
+ value: ''
33
+ }
34
+ },
35
+
36
+ data: {
37
+ activeName: '',
38
+ activeColor: ''
39
+ },
40
+
41
+ methods: {
42
+ onClick(ev = null) {
43
+ const parent = this.parent
44
+
45
+ parent.triggerEvent('click', this.data.name)
46
+
47
+ const baseLeft = parent.data.baseLeft
48
+
49
+ const query = this.createSelectorQuery()
50
+
51
+ query.select('.m-tab-item').boundingClientRect()
52
+ query.select('.m-tab-item__text').boundingClientRect()
53
+
54
+ query.exec(res => {
55
+ const offsetLeft = ev ? ev.currentTarget.offsetLeft : res[0].left - baseLeft
56
+ const itemWidth = res[0].width
57
+ const textWidth = res[1].width
58
+
59
+ parent.updateScrollPositon(offsetLeft, itemWidth, textWidth, this.data.name)
60
+ })
61
+ }
62
+ }
63
+ })
@@ -0,0 +1,6 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {
4
+ "bld-badge": "../bld-badge/index"
5
+ }
6
+ }
@@ -0,0 +1,35 @@
1
+ :host {
2
+ flex: 1;
3
+ }
4
+
5
+ .m-tab-item {
6
+ position: relative;
7
+ flex: 1;
8
+ box-sizing: border-box;
9
+ padding: 0 5px;
10
+ display: flex;
11
+ justify-content: center;
12
+ color: #7d7e80;
13
+ line-height: 88rpx;
14
+ font-size: 28rpx;
15
+ -webkit-tap-highlight-color: transparent;
16
+
17
+ &.is-active {
18
+ font-weight: 500;
19
+ color: #323233;
20
+ }
21
+
22
+ .m-tab-item__content {
23
+ margin: 0 20rpx;
24
+ white-space: nowrap;
25
+
26
+ .m-tab-item__text {
27
+ display: inline-block;
28
+
29
+ .m-badge-custom {
30
+ margin-left: 6rpx;
31
+ vertical-align: text-top;
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,8 @@
1
+ <view class="m-tab-item {{activeName === name ? 'is-active': ''}}" bind:tap="onClick">
2
+ <view class="m-tab-item__content">
3
+ <view class="m-tab-item__text" style="{{ activeColor ? 'color:' + activeColor: '' }}">
4
+ {{ title }}
5
+ <bld-badge wx:if="{{ value }}" custom-class="m-badge-custom" value="{{ value }}" static />
6
+ </view>
7
+ </view>
8
+ </view>
@@ -0,0 +1,31 @@
1
+ :host {
2
+ flex: 1;
3
+ }
4
+
5
+ .m-tab-item {
6
+ position: relative;
7
+ flex: 1;
8
+ box-sizing: border-box;
9
+ padding: 0 5px;
10
+ display: flex;
11
+ justify-content: center;
12
+ color: #7d7e80;
13
+ line-height: 88rpx;
14
+ font-size: 28rpx;
15
+ -webkit-tap-highlight-color: transparent;
16
+ }
17
+ .m-tab-item.is-active {
18
+ font-weight: 500;
19
+ color: #323233;
20
+ }
21
+ .m-tab-item .m-tab-item__content {
22
+ margin: 0 20rpx;
23
+ white-space: nowrap;
24
+ }
25
+ .m-tab-item .m-tab-item__content .m-tab-item__text {
26
+ display: inline-block;
27
+ }
28
+ .m-tab-item .m-tab-item__content .m-tab-item__text .m-badge-custom {
29
+ margin-left: 6rpx;
30
+ vertical-align: text-top;
31
+ }