Skip to content

Commit e459b19

Browse files
张寸起7insummer
authored andcommitted
feat:增加count-selector组件返回数据字段
1 parent df48c0e commit e459b19

File tree

8 files changed

+40
-11
lines changed

8 files changed

+40
-11
lines changed

dist/count-selector/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Component({
3838
methods: {
3939
doNothing(e) {
4040
const { type } = e.currentTarget.dataset;
41-
this.triggerEvent('linout', { type }, {
41+
this.triggerEvent('linout', { type, way: 'icon' }, {
4242
bubbles: true,
4343
composed: true
4444
});
@@ -66,9 +66,19 @@ Component({
6666
if (value) {
6767
if (value > this.properties.max) this.setData({
6868
count: this.properties.max
69+
}, () => {
70+
this.triggerEvent('linout', { type: 'overflow_max', way: 'input' }, {
71+
bubbles: true,
72+
composed: true
73+
});
6974
});
7075
else if (value < this.properties.min) this.setData({
7176
count: this.properties.min
77+
},() => {
78+
this.triggerEvent('linout', { type: 'overflow_min', way: 'input' }, {
79+
bubbles: true,
80+
composed: true
81+
});
7282
});
7383
else this.setData({
7484
count: value

dist/count-selector/index.wxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<view class="l-class container-count">
22
<view class="symbol {{count<=min|| disabled?'disabled l-disabled-class':'abled l-symbol-class'}}"
33
catchtap="{{count<=min|| disabled?'doNothing':'reduceTap'}}"
4-
data-type="reduce">
4+
data-type="overflow_min">
55
<text>-</text>
66
</view>
77
<input wx:if="{{focus}}"
@@ -14,7 +14,7 @@
1414
<view wx:else class="l-count-class count" bindtap="onCount">{{count}}</view>
1515
<view class="l-symbol-class symbol {{count>=max|| disabled?'disabled l-disabled-class':'abled l-symbol-class'}}"
1616
catchtap="{{count>=max|| disabled?'doNothing':'addTap'}}"
17-
data-type="reduce">
17+
data-type="overflow_max">
1818
<text>+</text>
1919
</view>
2020
</view>

examples/dist/count-selector/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Component({
3838
methods: {
3939
doNothing(e) {
4040
const { type } = e.currentTarget.dataset;
41-
this.triggerEvent('linout', { type }, {
41+
this.triggerEvent('linout', { type, way: 'icon' }, {
4242
bubbles: true,
4343
composed: true
4444
});
@@ -66,9 +66,19 @@ Component({
6666
if (value) {
6767
if (value > this.properties.max) this.setData({
6868
count: this.properties.max
69+
}, () => {
70+
this.triggerEvent('linout', { type: 'overflow_max', way: 'input' }, {
71+
bubbles: true,
72+
composed: true
73+
});
6974
});
7075
else if (value < this.properties.min) this.setData({
7176
count: this.properties.min
77+
},() => {
78+
this.triggerEvent('linout', { type: 'overflow_min', way: 'input' }, {
79+
bubbles: true,
80+
composed: true
81+
});
7282
});
7383
else this.setData({
7484
count: value

examples/dist/count-selector/index.wxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<view class="l-class container-count">
22
<view class="symbol {{count<=min|| disabled?'disabled l-disabled-class':'abled l-symbol-class'}}"
33
catchtap="{{count<=min|| disabled?'doNothing':'reduceTap'}}"
4-
data-type="reduce">
4+
data-type="overflow_min">
55
<text>-</text>
66
</view>
77
<input wx:if="{{focus}}"
@@ -14,7 +14,7 @@
1414
<view wx:else class="l-count-class count" bindtap="onCount">{{count}}</view>
1515
<view class="l-symbol-class symbol {{count>=max|| disabled?'disabled l-disabled-class':'abled l-symbol-class'}}"
1616
catchtap="{{count>=max|| disabled?'doNothing':'addTap'}}"
17-
data-type="reduce">
17+
data-type="overflow_max">
1818
<text>+</text>
1919
</view>
2020
</view>

examples/pages/components/shopping/pages/count-selector/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Page({
2121
wx.showToast({
2222
title: '超出限制',
2323
})
24-
console.log(e)
2524
},
2625

2726
/**
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<status show bg-color="{{bgColor}}" button-text="{{buttonText}}" image="{{image}}" describe="{{describe}}" type="{{type}}" />
1+
<status show bg-color="{{bgColor}}" button-text="{{buttonText}}" image="{{image}}" describe="{{describe}}" type="{{type}}"/>

src/count-selector/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Component({
3838
methods: {
3939
doNothing(e) {
4040
const { type } = e.currentTarget.dataset;
41-
this.triggerEvent('linout', { type }, {
41+
this.triggerEvent('linout', { type, way: 'icon' }, {
4242
bubbles: true,
4343
composed: true
4444
});
@@ -66,9 +66,19 @@ Component({
6666
if (value) {
6767
if (value > this.properties.max) this.setData({
6868
count: this.properties.max
69+
}, () => {
70+
this.triggerEvent('linout', { type: 'overflow_max', way: 'input' }, {
71+
bubbles: true,
72+
composed: true
73+
});
6974
});
7075
else if (value < this.properties.min) this.setData({
7176
count: this.properties.min
77+
},() => {
78+
this.triggerEvent('linout', { type: 'overflow_min', way: 'input' }, {
79+
bubbles: true,
80+
composed: true
81+
});
7282
});
7383
else this.setData({
7484
count: value

src/count-selector/index.wxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<view class="l-class container-count">
22
<view class="symbol {{count<=min|| disabled?'disabled l-disabled-class':'abled l-symbol-class'}}"
33
catchtap="{{count<=min|| disabled?'doNothing':'reduceTap'}}"
4-
data-type="reduce">
4+
data-type="overflow_min">
55
<text>-</text>
66
</view>
77
<input wx:if="{{focus}}"
@@ -14,7 +14,7 @@
1414
<view wx:else class="l-count-class count" bindtap="onCount">{{count}}</view>
1515
<view class="l-symbol-class symbol {{count>=max|| disabled?'disabled l-disabled-class':'abled l-symbol-class'}}"
1616
catchtap="{{count>=max|| disabled?'doNothing':'addTap'}}"
17-
data-type="reduce">
17+
data-type="overflow_max">
1818
<text>+</text>
1919
</view>
2020
</view>

0 commit comments

Comments
 (0)