@xtdev/xt-miniprogram-ui 0.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 ADDED
@@ -0,0 +1,54 @@
1
+ # 潭酒小程序基础组件库
2
+
3
+ ## 介绍
4
+
5
+ 本项目是一个基于潭酒【商家小程序】与【业务员小程序】抽离的UI组件库,提供了一系列可复用的UI组件,方便web开发人员快速构建页面。
6
+
7
+ ## 安装
8
+
9
+ npm安装:
10
+
11
+ ```
12
+ npm install @xtdev/xt-miniprogram-ui --save
13
+ ```
14
+
15
+ yarn安装:
16
+
17
+ ```
18
+ yarn add @xtdev/xt-miniprogram-ui
19
+ ```
20
+
21
+ ## 使用
22
+
23
+ import组件:
24
+
25
+ ```
26
+ import { button } from "ui-lib";
27
+ ```
28
+
29
+ 使用组件:
30
+
31
+ ```
32
+ <button>按钮</button>
33
+ ```
34
+
35
+ ## API 文档
36
+
37
+ ### Button 按钮
38
+
39
+ | 属性 | 类型 | 默认值 | 说明 |
40
+ | ------- | ------------- | ------ | --------------------------- |
41
+ | size | string | | 尺寸,可选值为`small`、`large` |
42
+ | type | string | | 类型,可选值为`primary`、`danger` |
43
+ | loading | boolean | false | 是否加载中 |
44
+ | onClick | (event) => {} | | 点击按钮的回调函数 |
45
+
46
+ ### Input 输入框
47
+
48
+ | 属性 | 类型 | 默认值 | 说明 |
49
+ | ------- | ------ | ------ | ------------ |
50
+ | type | string | text | 输入框类型 |
51
+ | size | string | | 尺寸 |
52
+ | prefix | node | | 前缀图标节点 |
53
+ | suffix | node | | 后缀图标节点 |
54
+ | onChange| (event) => {} | | 输入框值改变时的回调函数 |
@@ -0,0 +1 @@
1
+ {"dependencies":{}}
@@ -0,0 +1,24 @@
1
+ Component({
2
+ /**
3
+ * 组件的属性列表
4
+ */
5
+ properties: {
6
+ icon: {
7
+ type: String,
8
+ },
9
+ size: {
10
+ type: Number,
11
+ value: 28,
12
+ },
13
+ },
14
+
15
+ /**
16
+ * 组件的初始数据
17
+ */
18
+ data: {},
19
+
20
+ /**
21
+ * 组件的方法列表
22
+ */
23
+ methods: {},
24
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {}
4
+ }
@@ -0,0 +1,2 @@
1
+ <!--pages/components/xt-icon.wxml-->
2
+ <text class="iconfont icon-{{icon}}" style="font-size: {{size}}rpx;"></text>
@@ -0,0 +1,180 @@
1
+ @font-face {
2
+ font-family: "iconfont"; /* Project id 4088939 */
3
+ src: url("//at.alicdn.com/t/c/font_4088939_xa6wjfwsbpj.woff2?t=1685353003131")
4
+ format("woff2"),
5
+ url("//at.alicdn.com/t/c/font_4088939_xa6wjfwsbpj.woff?t=1685353003131")
6
+ format("woff"),
7
+ url("//at.alicdn.com/t/c/font_4088939_xa6wjfwsbpj.ttf?t=1685353003131")
8
+ format("truetype");
9
+ }
10
+
11
+ .iconfont {
12
+ font-family: "iconfont" !important;
13
+ font-style: normal;
14
+ -webkit-font-smoothing: antialiased;
15
+ -moz-osx-font-smoothing: grayscale;
16
+ }
17
+
18
+ .icon-a-8:before {
19
+ content: "\e61e";
20
+ }
21
+
22
+ .icon-a-9:before {
23
+ content: "\e61f";
24
+ }
25
+
26
+ .icon-a-10:before {
27
+ content: "\e620";
28
+ }
29
+
30
+ .icon-a-13:before {
31
+ content: "\e621";
32
+ }
33
+
34
+ .icon-a-15:before {
35
+ content: "\e622";
36
+ }
37
+
38
+ .icon-a-16:before {
39
+ content: "\e623";
40
+ }
41
+
42
+ .icon-a-11:before {
43
+ content: "\e624";
44
+ }
45
+
46
+ .icon-a-12:before {
47
+ content: "\e625";
48
+ }
49
+
50
+ .icon-a-14:before {
51
+ content: "\e626";
52
+ }
53
+
54
+ .icon-a-23:before {
55
+ content: "\e627";
56
+ }
57
+
58
+ .icon-a-19:before {
59
+ content: "\e628";
60
+ }
61
+
62
+ .icon-a-22:before {
63
+ content: "\e629";
64
+ }
65
+
66
+ .icon-a-21:before {
67
+ content: "\e62a";
68
+ }
69
+
70
+ .icon-a-20:before {
71
+ content: "\e62b";
72
+ }
73
+
74
+ .icon-a-18:before {
75
+ content: "\e62c";
76
+ }
77
+
78
+ .icon-a-17:before {
79
+ content: "\e62d";
80
+ }
81
+
82
+ .icon-xingzhuangjiehe:before {
83
+ content: "\e60e";
84
+ }
85
+
86
+ .icon-a-3:before {
87
+ content: "\e60f";
88
+ }
89
+
90
+ .icon-a-4:before {
91
+ content: "\e614";
92
+ }
93
+
94
+ .icon-a-2:before {
95
+ content: "\e615";
96
+ }
97
+
98
+ .icon-a-5:before {
99
+ content: "\e616";
100
+ }
101
+
102
+ .icon-a-6:before {
103
+ content: "\e61c";
104
+ }
105
+
106
+ .icon-a-7:before {
107
+ content: "\e61d";
108
+ }
109
+
110
+ .icon-jian-weixuanzhong:before {
111
+ content: "\e682";
112
+ }
113
+
114
+ .icon-jia-xuanzhong:before {
115
+ content: "\e683";
116
+ }
117
+
118
+ .icon-jian-xuanzhong:before {
119
+ content: "\e684";
120
+ }
121
+
122
+ .icon-xiala:before {
123
+ content: "\e685";
124
+ }
125
+
126
+ .icon-shangla:before {
127
+ content: "\e686";
128
+ }
129
+
130
+ .icon-jinggao:before {
131
+ content: "\e687";
132
+ }
133
+
134
+ .icon-weixuanzhong1:before {
135
+ content: "\e688";
136
+ }
137
+
138
+ .icon-jinggao-hong:before {
139
+ content: "\e60b";
140
+ }
141
+
142
+ .icon-daohang:before {
143
+ content: "\e60d";
144
+ }
145
+
146
+ .icon-shouqi:before {
147
+ content: "\e610";
148
+ }
149
+
150
+ .icon-shaixuan:before {
151
+ content: "\e611";
152
+ }
153
+
154
+ .icon-shanchu:before {
155
+ content: "\e612";
156
+ }
157
+
158
+ .icon-sousuo:before {
159
+ content: "\e613";
160
+ }
161
+
162
+ .icon-zhengque:before {
163
+ content: "\e617";
164
+ }
165
+
166
+ .icon-wenhao-xiao:before {
167
+ content: "\e618";
168
+ }
169
+
170
+ .icon-youjiantou:before {
171
+ content: "\e619";
172
+ }
173
+
174
+ .icon-wenhao:before {
175
+ content: "\e61a";
176
+ }
177
+
178
+ .icon-zhankai:before {
179
+ content: "\e61b";
180
+ }
@@ -0,0 +1,25 @@
1
+ // pages/components/xt-icon.js
2
+ Component({
3
+ /**
4
+ * 组件的属性列表
5
+ */
6
+ properties: {
7
+ icon: {
8
+ type: String,
9
+ },
10
+ size: {
11
+ type: Number,
12
+ value: 28,
13
+ },
14
+ },
15
+
16
+ /**
17
+ * 组件的初始数据
18
+ */
19
+ data: {},
20
+
21
+ /**
22
+ * 组件的方法列表
23
+ */
24
+ methods: {},
25
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {}
4
+ }
@@ -0,0 +1,2 @@
1
+ <!--pages/components/xt-icon.wxml-->
2
+ <text class="iconfont icon-{{icon}}" style="font-size: {{size}}rpx;"></text>
@@ -0,0 +1,180 @@
1
+ @font-face {
2
+ font-family: "iconfont"; /* Project id 4088939 */
3
+ src: url("//at.alicdn.com/t/c/font_4088939_xa6wjfwsbpj.woff2?t=1685353003131")
4
+ format("woff2"),
5
+ url("//at.alicdn.com/t/c/font_4088939_xa6wjfwsbpj.woff?t=1685353003131")
6
+ format("woff"),
7
+ url("//at.alicdn.com/t/c/font_4088939_xa6wjfwsbpj.ttf?t=1685353003131")
8
+ format("truetype");
9
+ }
10
+
11
+ .iconfont {
12
+ font-family: "iconfont" !important;
13
+ font-style: normal;
14
+ -webkit-font-smoothing: antialiased;
15
+ -moz-osx-font-smoothing: grayscale;
16
+ }
17
+
18
+ .icon-a-8:before {
19
+ content: "\e61e";
20
+ }
21
+
22
+ .icon-a-9:before {
23
+ content: "\e61f";
24
+ }
25
+
26
+ .icon-a-10:before {
27
+ content: "\e620";
28
+ }
29
+
30
+ .icon-a-13:before {
31
+ content: "\e621";
32
+ }
33
+
34
+ .icon-a-15:before {
35
+ content: "\e622";
36
+ }
37
+
38
+ .icon-a-16:before {
39
+ content: "\e623";
40
+ }
41
+
42
+ .icon-a-11:before {
43
+ content: "\e624";
44
+ }
45
+
46
+ .icon-a-12:before {
47
+ content: "\e625";
48
+ }
49
+
50
+ .icon-a-14:before {
51
+ content: "\e626";
52
+ }
53
+
54
+ .icon-a-23:before {
55
+ content: "\e627";
56
+ }
57
+
58
+ .icon-a-19:before {
59
+ content: "\e628";
60
+ }
61
+
62
+ .icon-a-22:before {
63
+ content: "\e629";
64
+ }
65
+
66
+ .icon-a-21:before {
67
+ content: "\e62a";
68
+ }
69
+
70
+ .icon-a-20:before {
71
+ content: "\e62b";
72
+ }
73
+
74
+ .icon-a-18:before {
75
+ content: "\e62c";
76
+ }
77
+
78
+ .icon-a-17:before {
79
+ content: "\e62d";
80
+ }
81
+
82
+ .icon-xingzhuangjiehe:before {
83
+ content: "\e60e";
84
+ }
85
+
86
+ .icon-a-3:before {
87
+ content: "\e60f";
88
+ }
89
+
90
+ .icon-a-4:before {
91
+ content: "\e614";
92
+ }
93
+
94
+ .icon-a-2:before {
95
+ content: "\e615";
96
+ }
97
+
98
+ .icon-a-5:before {
99
+ content: "\e616";
100
+ }
101
+
102
+ .icon-a-6:before {
103
+ content: "\e61c";
104
+ }
105
+
106
+ .icon-a-7:before {
107
+ content: "\e61d";
108
+ }
109
+
110
+ .icon-jian-weixuanzhong:before {
111
+ content: "\e682";
112
+ }
113
+
114
+ .icon-jia-xuanzhong:before {
115
+ content: "\e683";
116
+ }
117
+
118
+ .icon-jian-xuanzhong:before {
119
+ content: "\e684";
120
+ }
121
+
122
+ .icon-xiala:before {
123
+ content: "\e685";
124
+ }
125
+
126
+ .icon-shangla:before {
127
+ content: "\e686";
128
+ }
129
+
130
+ .icon-jinggao:before {
131
+ content: "\e687";
132
+ }
133
+
134
+ .icon-weixuanzhong1:before {
135
+ content: "\e688";
136
+ }
137
+
138
+ .icon-jinggao-hong:before {
139
+ content: "\e60b";
140
+ }
141
+
142
+ .icon-daohang:before {
143
+ content: "\e60d";
144
+ }
145
+
146
+ .icon-shouqi:before {
147
+ content: "\e610";
148
+ }
149
+
150
+ .icon-shaixuan:before {
151
+ content: "\e611";
152
+ }
153
+
154
+ .icon-shanchu:before {
155
+ content: "\e612";
156
+ }
157
+
158
+ .icon-sousuo:before {
159
+ content: "\e613";
160
+ }
161
+
162
+ .icon-zhengque:before {
163
+ content: "\e617";
164
+ }
165
+
166
+ .icon-wenhao-xiao:before {
167
+ content: "\e618";
168
+ }
169
+
170
+ .icon-youjiantou:before {
171
+ content: "\e619";
172
+ }
173
+
174
+ .icon-wenhao:before {
175
+ content: "\e61a";
176
+ }
177
+
178
+ .icon-zhankai:before {
179
+ content: "\e61b";
180
+ }
@@ -0,0 +1,125 @@
1
+ // components/v-tab/index.js
2
+ Component({
3
+ /**
4
+ * 组件的属性列表
5
+ */
6
+ properties: {
7
+ // 搜索框样式,是否是圆的,默认为方
8
+ isCircle: {
9
+ type: Boolean,
10
+ value: true
11
+ },
12
+ // 是否展示右侧更多按钮
13
+ showMore: {
14
+ type: Boolean,
15
+ value: false
16
+ },
17
+ list: {
18
+ type: Array,
19
+ value: [
20
+ {
21
+ name: '',
22
+ show: true
23
+ }
24
+ ]
25
+ },
26
+ index: {
27
+ type: Number,
28
+ value: 0
29
+ },
30
+ placeholder: {
31
+ type: String,
32
+ value: "请输入内容"
33
+ },
34
+ // 是否自动聚焦
35
+ isFocus: {
36
+ type: Boolean,
37
+ value: false
38
+ },
39
+ value: {
40
+ type: String,
41
+ value: ''
42
+ },
43
+ // 是否远程搜索,如果为true。点击输入框将只执行onFocus指令。适用于跳转新页面搜索场景
44
+ remote: {
45
+ type: Boolean,
46
+ value: false
47
+ },
48
+ rightBtnText: {
49
+ type: String,
50
+ value: '搜索'
51
+ },
52
+ extendType: {
53
+ type: Number,
54
+ value: 1
55
+ }
56
+ },
57
+
58
+ /**
59
+ * 组件的初始数据
60
+ */
61
+ data: {
62
+ isActive: false,
63
+ // 输入框的输入值
64
+ inputVal: ''
65
+ },
66
+
67
+ /**
68
+ * 组件的方法列表
69
+ */
70
+ methods: {
71
+ onFocus() {
72
+ if (!this.data.remote) {
73
+ this.setData({
74
+ isActive: true
75
+ });
76
+ }
77
+ this.triggerEvent('onFocus');
78
+ },
79
+ onBlur() {
80
+ this.setData({
81
+ isActive: false
82
+ });
83
+ this.triggerEvent('onBlur');
84
+ },
85
+ onInput(e) {
86
+ this.setData({
87
+ inputVal: e.detail.value
88
+ });
89
+ this.triggerEvent('onInput', e.detail.value);
90
+ },
91
+ clearInpVal() {
92
+ this.setData({
93
+ inputVal: ''
94
+ });
95
+ if (!this.data.isActive) {
96
+ this.triggerEvent('onClear');
97
+ }
98
+ },
99
+ onSearch() {
100
+ console.log('输入值value', this.data.inputVal);
101
+ this.triggerEvent('onSearch', this.data.inputVal);
102
+ },
103
+ onSelect(e) {
104
+ const val = e.currentTarget.dataset.value;
105
+ if (val == 'receive') {
106
+ wx.navigateTo({
107
+ url: `/packageD/pages/searchPoint/index?type=${this.properties.extendType === 1 ? 'agent' : 'cigarette'}`
108
+ });
109
+ } else {
110
+ wx.navigateTo({
111
+ url: `/packageD/pages/deletePoint/index?status=remove&type=${this.properties.extendType === 1 ? 'agent' : 'cigarette'}`
112
+ });
113
+ }
114
+ this.selectComponent('#item').toggle();
115
+ }
116
+ },
117
+ observers: {
118
+ value(val) {
119
+ this.setData({
120
+ inputVal: val
121
+ });
122
+ }
123
+ }
124
+ });
125
+
@@ -0,0 +1,7 @@
1
+ {
2
+ "component": true,
3
+ "styleIsolation": "apply-shared",
4
+ "usingComponents": {
5
+ "xt-icon": "../xt-icon"
6
+ }
7
+ }
@@ -0,0 +1,17 @@
1
+ <!--components/xt-search.wxml-->
2
+ <view class="container">
3
+ <view class="search-box {{isActive? 'search-active':''}} {{isCircle? 'search-box-circle' : ''}}">
4
+ <xt-icon class="search-icon" slot="left-icon" icon="sousuo" size="34"></xt-icon>
5
+ <view class="search-input {{inputVal ?'' : 'placeholder'}}" bind:tap="onFocus" wx:if="{{remote}}" data-name='搜索'>
6
+ {{inputVal||placeholder}}
7
+ </view>
8
+ <input class="search-input" placeholder-class="palceholder" confirm-type="search" bind:focus="onFocus" wx:else bindblur="onBlur" bindinput="onInput" value="{{ inputVal }}" bind:confirm="onSearch" focus="{{isFocus}}" placeholder="{{placeholder}}" />
9
+ <view slot="action" class="search-btn {{isCircle? 'search-btn-circle' : ''}}" placeholder="{{placeholder}}">
10
+ <view wx:if="{{inputVal}}" class="clearimg-box" catchtap="clearInpVal" data-name='清除'>
11
+ <xt-icon class="clear-img" icon="a-19" size="34"></xt-icon>
12
+ </view>
13
+ <text bind:tap="onSearch" class="search-text" data-name='搜索'>{{rightBtnText}}</text>
14
+ </view>
15
+ </view>
16
+ <view slot="show-more"></view>
17
+ </view>
@@ -0,0 +1,82 @@
1
+ /* components/xt-search.wxss */
2
+ .container {
3
+ position: relative;
4
+ display: flex;
5
+ }
6
+
7
+ .search-box {
8
+ border: 2rpx solid #dddddd;
9
+ background-color: white;
10
+ box-sizing: border-box;
11
+ overflow: hidden;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: space-between;
15
+ height: 80rpx;
16
+ border-radius: 10rpx;
17
+ overflow: hidden;
18
+ flex: 1;
19
+ }
20
+
21
+ .search-box-circle {
22
+ border-radius: 40rpx;
23
+ }
24
+
25
+ .search-icon {
26
+ color: #999999;
27
+ padding-left: 24rpx;
28
+ padding-right: 8rpx;
29
+ }
30
+
31
+ .search-input {
32
+ width: 100%;
33
+ flex: 1;
34
+ font-size: 34rpx;
35
+ font-weight: 400;
36
+ }
37
+
38
+ .palceholder {
39
+ font-size: 34rpx;
40
+ color: #999999;
41
+ }
42
+
43
+ .clearimg-box {
44
+ width: 64rpx;
45
+ }
46
+
47
+ .clear-img {
48
+ z-index: 999;
49
+ color: #999999;
50
+ }
51
+
52
+ .search-btn {
53
+ display: flex;
54
+ align-items: center;
55
+ height: 40rpx;
56
+ line-height: 40rpx;
57
+ box-sizing: border-box;
58
+ text-align: center;
59
+ font-weight: 800;
60
+ color: #6722ab;
61
+ }
62
+
63
+ .search-btn .search-text {
64
+ font-size: 28rpx;
65
+ width: 120rpx;
66
+ display: inline-block;
67
+ border-left: 2rpx solid #e5e5e5;
68
+ line-height: 32rpx !important;
69
+ }
70
+
71
+ .search-btn-circle .search-text {
72
+ width: 132rpx;
73
+ font-size: 34rpx;
74
+ }
75
+
76
+ .search-active {
77
+ border-color: #6722ab;
78
+ }
79
+
80
+ .placeholder {
81
+ color: #999999;
82
+ }
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@xtdev/xt-miniprogram-ui",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "files": [
6
+ "libs",
7
+ "README.md"
8
+ ],
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "dev": "gulp",
12
+ "build": "gulp build"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://gitlab.tanjiu.cn/tfe/scaffold/xt-micro-components.git"
17
+ },
18
+ "author": "",
19
+ "license": "ISC",
20
+ "devDependencies": {
21
+ "del": "^3.0.0",
22
+ "gulp": "^4.0.2",
23
+ "gulp-changed": "^4.0.3",
24
+ "gulp-clean": "^0.4.0",
25
+ "gulp-json-transform": "^0.4.8",
26
+ "gulp-rename": "^2.0.0"
27
+ },
28
+ "dependencies": {}
29
+ }