Skip to content

Commit 19dc374

Browse files
committed
build: Travis CI automatic compilation
1 parent 59940f9 commit 19dc374

File tree

8 files changed

+84
-0
lines changed

8 files changed

+84
-0
lines changed

dist/switch/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/switch/index.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"component":true,"usingComponents":{}}

dist/switch/index.wxml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<view class="switch {{disabled ? 'switch-disabled l-disabled-class' : 'l-class'}} {{ checked === activeValue ? 'switch-on' : '' }}" style="background-color:{{checked === activeValue ? selectColor : color}};font-size:{{size}};" bind:tap="onClick">
2+
<view class="switch-node"></view>
3+
</view>

dist/switch/index.wxss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.switch{position:relative;display:inline-block;box-sizing:content-box;width:2em;height:1em;background-color:#fff;border:1px solid rgba(0,0,0,.1);border-radius:1em;transition:background-color .3s}.switch-node{position:absolute;top:0;left:0;border-radius:100%;z-index:1;width:1em;height:1em;background-color:#fff;box-shadow:0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05);transition:.3s cubic-bezier(.3,1.05,.4,1.05)}.switch-on .switch-node{transform:translateX(calc(1em))}.switch-disabled{opacity:.5}

examples/dist/switch/index.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import eventBus from '../core/utils/event-bus';
2+
3+
Component({
4+
externalClasses: ['l-class', 'l-disabled-class'],
5+
properties: {
6+
checked: {
7+
type: null,
8+
optionalTypes: [Boolean, String, Number],
9+
value: false
10+
},
11+
size: {
12+
type: String,
13+
value: '38rpx'
14+
},
15+
color: {
16+
type: String,
17+
value: '#fff'
18+
},
19+
// 选中后的颜色
20+
selectColor: {
21+
type: String,
22+
value: '#3963BC'
23+
},
24+
activeValue: {
25+
type: null,
26+
value: true,
27+
},
28+
inactiveValue: {
29+
type: null,
30+
value: false,
31+
},
32+
// 不可选状态
33+
disabled: {
34+
type: Boolean,
35+
value: false
36+
},
37+
},
38+
methods: {
39+
onClick() {
40+
const { activeValue, inactiveValue, disabled } = this.data;
41+
42+
if (disabled) {
43+
return;
44+
}
45+
46+
const checked = this.data.checked === activeValue;
47+
const value = checked ? inactiveValue : activeValue;
48+
49+
this.setData({
50+
checked: value
51+
});
52+
53+
this.triggerEvent('linchange', { checked: value });
54+
eventBus.emit(`lin-form-change-${this.id}`, this.id);
55+
},
56+
57+
getValues() {
58+
return this.data.checked;
59+
},
60+
61+
reset() {
62+
this.setData({
63+
checked: this.data.inactiveValue
64+
});
65+
}
66+
}
67+
});

examples/dist/switch/index.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"component": true,
3+
"usingComponents": {}
4+
}

examples/dist/switch/index.wxml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<view
2+
class="switch {{disabled ? 'switch-disabled l-disabled-class' : 'l-class'}} {{ checked === activeValue ? 'switch-on' : '' }}"
3+
style="background-color:{{checked === activeValue ? selectColor : color}};font-size:{{size}};"
4+
bind:tap="onClick">
5+
<view class="switch-node"></view>
6+
</view>

examples/dist/switch/index.wxss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.switch{position:relative;display:inline-block;box-sizing:content-box;width:2em;height:1em;background-color:#fff;border:1px solid rgba(0,0,0,.1);border-radius:1em;transition:background-color .3s}.switch-node{position:absolute;top:0;left:0;border-radius:100%;z-index:1;width:1em;height:1em;background-color:#fff;box-shadow:0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05);transition:.3s cubic-bezier(.3,1.05,.4,1.05)}.switch-on .switch-node{transform:translateX(calc(1em))}.switch-disabled{opacity:.5}

0 commit comments

Comments
 (0)