Skip to content

Commit

Permalink
add switch
Browse files Browse the repository at this point in the history
  • Loading branch information
东杰 committed May 5, 2019
1 parent d05bc20 commit c4af982
Show file tree
Hide file tree
Showing 17 changed files with 176 additions and 0 deletions.
2 changes: 2 additions & 0 deletions demo/app.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"pages":[
"pages/switch/index",
"pages/rate/index",
"pages/search/index",
"pages/main/index",
"pages/input/index",
Expand Down
16 changes: 16 additions & 0 deletions demo/dist/switch/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Component({
properties: {
color: {
type: String,
value: ''
},
checked: {
type: Boolean,
value: false
},
disabled: {
type: Boolean,
value: false
}
}
});
6 changes: 6 additions & 0 deletions demo/dist/switch/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"d-icon": "../icon/index"
}
}
6 changes: 6 additions & 0 deletions demo/dist/switch/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<switch
class="d-switch"
color="{{color}}"
checked="{{checked}}"
disabled="{{disabled}}"
></switch>
1 change: 1 addition & 0 deletions demo/dist/switch/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@font-face{font-family:iconfont;src:url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAABQgAAsAAAAAJcgAABPQAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCILAq1XKs7ATYCJAOBIAtSAAQgBYRtB4MFG4ofBeOYFbBxAEhjr4+o0vSy/8sE49jHYazhMtryiHrXERp+oceCMlxps4uyeZ23PL7c8N8dSnnEz9nPvvcSIkogJXFIKBSCaIJHDNEEOBpaUixIJRXnWqBuSEW/VkQ5oyZU/EjqnDgSAL7NV936MDMsrqNvtzOm74T/KI5A/4RImfedmr2xtLGhQ2BBaRzoIfrH+rXuWLYDJUhSGiCmtvzuvgc9QBD1lYLh3ZeUIjHKYLQsimGEgQ1X9pagwGhD/uD//Ru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A==') format('woff2')}.iconfont{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block}.icon-check-fill:before{content:"\e627"}.icon-circle:before{content:"\e614"}.icon-fail:before{content:"\e610"}.icon-success:before{content:"\e77d"}.icon-error:before{content:"\e77e"}.icon-warning:before{content:"\e785"}.icon-message:before{content:"\e78a"}.icon-setting:before{content:"\e78e"}.icon-eye:before{content:"\e78f"}.icon-location:before{content:"\e790"}.icon-adduser:before{content:"\e7ae"}.icon-user:before{content:"\e7af"}.icon-home:before{content:"\e7c6"}.icon-like:before{content:"\e7c8"}.icon-unlike:before{content:"\e7c9"}.icon-camera:before{content:"\e7d7"}.icon-cloud-download:before{content:"\e7d9"}.icon-sound:before{content:"\e7da"}.icon-heart:before{content:"\e7df"}.icon-star:before{content:"\e7e0"}.icon-wifi:before{content:"\e7e1"}.icon-man:before{content:"\e7e2"}.icon-share:before{content:"\e7e7"}.icon-right:before{content:"\e7eb"}.icon-left:before{content:"\e7ec"}.icon-up:before{content:"\e7ed"}.icon-down:before{content:"\e7ee"}.icon-menu:before{content:"\e7f4"}.icon-check:before{content:"\e7fc"}.icon-close:before{content:"\e7fd"}.icon-tel:before{content:"\e725"}.icon-phone:before{content:"\e60b"}.icon-caret-down:before{content:"\e8ec"}.icon-caret-up:before{content:"\e8ed"}.icon-caret-right:before{content:"\e8ee"}.icon-caret-left:before{content:"\e8ef"}.icon-search:before{content:"\e8f0"}.icon-close-circle:before{content:"\e63c"}.icon-plus:before{content:"\e8fe"}
66 changes: 66 additions & 0 deletions demo/pages/rate/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// pages/rate/index.js
Page({

/**
* 页面的初始数据
*/
data: {

},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {

},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {

},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {

},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {

},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {

},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {

},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {

},

/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {

}
})
3 changes: 3 additions & 0 deletions demo/pages/rate/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
2 changes: 2 additions & 0 deletions demo/pages/rate/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!--pages/rate/index.wxml-->
<text>pages/rate/index.wxml</text>
1 change: 1 addition & 0 deletions demo/pages/rate/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* pages/rate/index.wxss */
3 changes: 3 additions & 0 deletions demo/pages/switch/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Page({

})
6 changes: 6 additions & 0 deletions demo/pages/switch/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "Switch 开关",
"usingComponents": {
"d-switch": "../../dist/switch/index"
}
}
16 changes: 16 additions & 0 deletions demo/pages/switch/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

<view class="demo-box">
<view class="demo-title">普通switch</view>
<view class="demo-content">
<d-switch checked></d-switch>
</view>
<view class="demo-title">不同颜色的switch</view>
<view class="demo-content">
<d-switch color="#36CFC9" checked></d-switch>
<d-switch color="#f5222d" checked></d-switch>
</view>
<view class="demo-title">禁用switch</view>
<view class="demo-content">
<d-switch disabled></d-switch>
</view>
</view>
17 changes: 17 additions & 0 deletions demo/pages/switch/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@import '../../dist/styles/_mixins.wxss';

.demo-box{
background: #f8f8f8;
margin-bottom: 20rpx;
}
.demo-title{
font-size: 32rpx;
color: #333;
padding-bottom: 30rpx;
padding-left: 30rpx;
padding-top: 30rpx;
}
.demo-content{
background: #fff;
padding: 10px;
}
16 changes: 16 additions & 0 deletions src/switch/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Component({
properties: {
color: {
type: String,
value: ''
},
checked: {
type: Boolean,
value: false
},
disabled: {
type: Boolean,
value: false
}
}
});
6 changes: 6 additions & 0 deletions src/switch/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"d-icon": "../icon/index"
}
}
3 changes: 3 additions & 0 deletions src/switch/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import '../icon/index.less';

.d-switch{}
6 changes: 6 additions & 0 deletions src/switch/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<switch
class="d-switch"
color="{{color}}"
checked="{{checked}}"
disabled="{{disabled}}"
></switch>

0 comments on commit c4af982

Please sign in to comment.