init project
This commit is contained in:
40
component/actionSheet/actionSheet.js
Normal file
40
component/actionSheet/actionSheet.js
Normal file
@@ -0,0 +1,40 @@
|
||||
// component/actionSheet/actionSheet.js
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
value:{
|
||||
type: Array,
|
||||
value: []
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
// 点击取消
|
||||
cancel() {
|
||||
this.triggerEvent('cancel', {}, {});
|
||||
},
|
||||
|
||||
// 点击选择
|
||||
click(e) {
|
||||
let index = e.currentTarget.dataset.index;
|
||||
this.triggerEvent('selected', this.data.value[index], {});
|
||||
},
|
||||
|
||||
// 禁止背景滚动
|
||||
unMove() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
})
|
||||
4
component/actionSheet/actionSheet.json
Normal file
4
component/actionSheet/actionSheet.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
7
component/actionSheet/actionSheet.wxml
Normal file
7
component/actionSheet/actionSheet.wxml
Normal file
@@ -0,0 +1,7 @@
|
||||
<!--component/actionSheet/actionSheet.wxml-->
|
||||
<view class='popup-box' catchtouchmove='unMove' catchtap='cancel'>
|
||||
<view class='body'>
|
||||
<view class='cell' wx:for="{{value}}" wx:key="{{index}}" catchtap='click' data-index='{{index}}'>{{item.label}}</view>
|
||||
<view class='cell cancel' catchtap='cancel'>取消</view>
|
||||
</view>
|
||||
</view>
|
||||
32
component/actionSheet/actionSheet.wxss
Normal file
32
component/actionSheet/actionSheet.wxss
Normal file
@@ -0,0 +1,32 @@
|
||||
/* component/actionSheet/actionSheet.wxss */
|
||||
|
||||
.popup-box {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.popup-box .body {
|
||||
flex: 1;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.popup-box .body .cell {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
margin-bottom: 2rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
background: #FFF;
|
||||
}
|
||||
|
||||
.popup-box .body .cell.cancel {
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user