// component/UISwitcher/UISwitcher.js
Component({
/**
* 组件的属性列表
*/
properties: {
width:{
type:Number,
value:"144"
},
height:{
type:Number,
value:"64"
},
borderColor:{
type:String,
value:"#07B160"
},
selectDefault:{
type:Number,
value:0
},
showText:{
type:Boolean,
value:true
},
leftText:{
type:Object,
value:{
title:"开",
normalColor:"black",
selectedColor:"white"
}
},
rightText:{
type:Object,
value:{
title:"关",
normalColor:"black",
selectedColor:"white"
}
}
},
externalClasses:["normal-class","selected-class"],
/**
* 组件的初始数据
*/
data: {
borderRadius:72,
leftSelected:true,
leftPadding:0,
},
attached(){
let br = this.properties.height/2
this.setData({
borderRadius:br,
leftPadding:this.properties.selectDefault==0?"0":"50%",
width:Math.max(144,this.properties.width)
})
},
ready(){
},
/**
* 组件的方法列表
*/
methods: {
switcherAction(){
let st = !this.data.leftSelected
this.setData({leftSelected:st,leftPadding:st?"0%":"50%"})
this.triggerEvent("switcherActionListener",{"itemIndex":this.data.leftSelected?0:1})
}
}
})
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
switcher.zip (18个子文件)
switcher
app.js 1KB
project.config.json 816B
utils
util.js 472B
sitemap.json 191B
pages
components
UISwitcher
UISwitcher.wxml 700B
UISwitcher.js 2KB
UISwitcher.wxss 1KB
UISwitcher.json 52B
index
index.wxml 165B
index.js 1KB
index.wxss 341B
index.json 85B
logs
logs.wxml 173B
logs.js 261B
logs.wxss 106B
logs.json 77B
app.json 298B
app.wxss 194B
共 18 条
- 1
资源评论
zhaocarbon
- 粉丝: 4503
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功