Skip to content

Commit 7e4a784

Browse files
committed
chore: release v1.3.13
1 parent 104513f commit 7e4a784

File tree

6 files changed

+40
-12
lines changed

6 files changed

+40
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mpx-cube-ui",
3-
"version": "1.3.12",
3+
"version": "1.3.13",
44
"private": true,
55
"description": "mpx components library",
66
"author": "xiaolei <[email protected]>",

packages/extract-theme-var/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mpxjs/extract-theme-var",
3-
"version": "1.3.12",
3+
"version": "1.3.13",
44
"description": "mpx-cube-ui theme variable extractor",
55
"publishConfig": {
66
"registry": "https://registry.npmjs.org",

packages/mpx-cube-ui/lib/components/switch/rn-mixin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ if (__mpx_mode__ === 'ios' || __mpx_mode__ === 'android') {
1515
'cube-switch-BGC': (animationOptions) => {
1616
const animation = this.bgAnimation || (this.bgAnimation = mpx.createAnimation({ ...animationOptions }));
1717
if (this.isOn) {
18-
const onBGC = this.switchOnGBC || '#FF6435';
18+
const onBGC = this.switchOnBGC || this.switchOnGBC || '#FF6435';
1919
animation.backgroundColor(onBGC).step({ duration: animationOptions.duration });
2020
}
2121
else {
22-
const defaultBGC = this.switchDefaultGBC || '#EAEAEA';
22+
const defaultBGC = this.switchDefaultBGC || this.switchDefaultGBC || '#EAEAEA';
2323
animation.backgroundColor(defaultBGC).step({ duration: animationOptions.duration });
2424
}
2525
this.switchAnimationData = animation.export();

packages/mpx-cube-ui/lib/components/switch/switch.js

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,22 @@ createComponent({
1111
type: Boolean,
1212
value: false
1313
},
14+
switchDefaultBGC: {
15+
type: String,
16+
value: ''
17+
},
18+
switchOnBGC: {
19+
type: String,
20+
value: ''
21+
},
22+
// @dosHide
23+
// props 命名错误,没人用就删掉
1424
switchDefaultGBC: {
1525
type: String,
1626
value: ''
1727
},
28+
// @dosHide
29+
// props 命名错误,没人用就删掉
1830
switchOnGBC: {
1931
type: String,
2032
value: ''
@@ -26,6 +38,14 @@ createComponent({
2638
disabled: {
2739
type: Boolean,
2840
value: false
41+
},
42+
/**
43+
* @description 点击后是否需要更改 value
44+
* @optional true/false
45+
*/
46+
changeOnClick: {
47+
type: Boolean,
48+
value: true
2949
}
3050
},
3151
data: {
@@ -40,17 +60,17 @@ createComponent({
4060
};
4161
},
4262
swithBGClass() {
43-
if (__mpx_mode__ === 'ios' || __mpx_mode__ === 'android') {
63+
if (__mpx_mode__ === 'ios' || __mpx_mode__ === 'android' || __mpx_mode__ === 'harmony') {
4464
return {};
4565
}
46-
if (this.isOn && this.switchOnGBC) {
66+
if (this.isOn && (this.switchOnBGC || this.switchOnGBC)) {
4767
return {
48-
backgroundColor: this.switchOnGBC
68+
backgroundColor: this.switchOnBGC || this.switchOnGBC
4969
};
5070
}
51-
else if (!this.isOn && this.switchDefaultGBC) {
71+
else if (!this.isOn && (this.switchDefaultBGC || this.switchDefaultGBC)) {
5272
return {
53-
backgroundColor: this.switchDefaultGBC
73+
backgroundColor: this.switchDefaultBGC || this.switchDefaultGBC
5474
};
5575
}
5676
else {
@@ -68,10 +88,18 @@ createComponent({
6888
},
6989
methods: {
7090
toggleSwitch() {
71-
if (this.disabled)
91+
if (this.disabled) {
92+
this.triggerEvent('click', { value: this.isOn });
7293
return;
94+
}
95+
if (!this.changeOnClick) {
96+
this.triggerEvent('click', { value: this.isOn });
97+
return;
98+
}
7399
const newValue = !this.isOn;
74100
this.isOn = newValue;
101+
// 当开关有点击时触发
102+
this.triggerEvent('click', { value: newValue });
75103
// 当开关状态变化时触发
76104
this.triggerEvent('change', { value: newValue });
77105
// 当开关状态变化时触发

packages/mpx-cube-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mpxjs/mpx-cube-ui",
3-
"version": "1.3.12",
3+
"version": "1.3.13",
44
"description": "mpx components library",
55
"author": "xiaolei <[email protected]>",
66
"publishConfig": {

packages/website-build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mpxjs/website-build",
3-
"version": "1.3.12",
3+
"version": "1.3.13",
44
"description": "mpx-cube-ui website builder",
55
"publishConfig": {
66
"registry": "https://registry.npmjs.org",

0 commit comments

Comments
 (0)