file-selector
This commit is contained in:
parent
11a7861252
commit
7d416a4cdd
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"g-btn": "../../UI/g-btn/index",
|
||||
"g-icon": "../../UI/g-icon/index"
|
||||
},
|
||||
"componentGenerics": {
|
||||
"item": true
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
@import "../../../styles/base.less";
|
||||
|
||||
.default-item-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.default-item {
|
||||
width: 200rpx;
|
||||
height: 300rpx;
|
||||
border: 1ch solid black;
|
||||
}
|
||||
|
||||
.insert-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
Component({
|
||||
externalClasses: ['item-container', 'item'],
|
||||
properties: {
|
||||
oakValue: Array,
|
||||
maxCount: Number,
|
||||
disableInsert: Boolean,
|
||||
},
|
||||
|
||||
methods: {
|
||||
onClick(touch: WechatMiniprogram.Touch) {
|
||||
},
|
||||
checkAllowInsert(value?: Array<any>, count?: number) {
|
||||
const count2 = count || this.data.maxCount;
|
||||
const value2 = value || this.data.oakValue;
|
||||
if (typeof count2 === 'number' && value2?.length >= count2) {
|
||||
this.setData({
|
||||
disableInsert: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
observers: {
|
||||
oakValue: function (oakValue) {
|
||||
this.checkAllowInsert(oakValue);
|
||||
},
|
||||
maxCount: function (maxCount) {
|
||||
this.checkAllowInsert(undefined, maxCount);
|
||||
}
|
||||
},
|
||||
|
||||
lifetimes: {
|
||||
ready() {
|
||||
this.checkAllowInsert();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<view class="default-item-container item-container">
|
||||
<view class="default-item item" wx:for="{{oakValue}}" wx:key="index">
|
||||
<item oak:value="item"/>
|
||||
</view>
|
||||
<view class="default-item item insert-btn" wx:if="{{!disableInsert}}">
|
||||
<g-icon name="add"></g-icon>>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -1,4 +1,2 @@
|
|||
<!-- index.wxml -->
|
||||
<view class="container">
|
||||
<image src="{{src}}" mode="aspectFit" />
|
||||
</view>
|
||||
<image src="{{src}}" mode="aspectFit" />
|
||||
Loading…
Reference in New Issue