增加选择品牌组件
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
// components/brandSelect/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
value: 500
|
||||
},
|
||||
position: {
|
||||
type: String,
|
||||
value: 'right'
|
||||
},
|
||||
round: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
overlay: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
customStyle: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
overlayStyle: {
|
||||
type: String,
|
||||
value: 'background-color: rgba(0, 0, 0, 0.7)'
|
||||
},
|
||||
},
|
||||
observers: {
|
||||
'show': function (value) {
|
||||
// 在 numberA 或者 numberB 被设置时,执行这个函数
|
||||
this.setData({
|
||||
show_page: value,
|
||||
cur: -1
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
show_page: false,
|
||||
// list: [],
|
||||
list: [{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
},{
|
||||
name: '宝马'
|
||||
}],
|
||||
cur: -1
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onBeforeEnter(res) {
|
||||
// console.log(res)
|
||||
},
|
||||
onEnter(res) {
|
||||
// console.log(res)
|
||||
this.triggerEvent('enter')
|
||||
},
|
||||
onAfterEnter(res) {
|
||||
// console.log(res)
|
||||
},
|
||||
onBeforeLeave(res) {
|
||||
// console.log(res)
|
||||
},
|
||||
onLeave(res) {
|
||||
// console.log(res)
|
||||
this.triggerEvent('leave', {index: this.data.cur})
|
||||
},
|
||||
onAfterLeave(res) {
|
||||
// console.log(res)
|
||||
},
|
||||
|
||||
onClickOverlay(res) {
|
||||
// console.log(res)
|
||||
},
|
||||
exit() {
|
||||
this.setData({ show_page: false })
|
||||
},
|
||||
bindSelectIndex(e){
|
||||
console.log(e)
|
||||
this.setData({
|
||||
cur: e.currentTarget.dataset.index
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"listmore": "/components/listMore/index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<!-- components/brandSelect/index.wxml -->
|
||||
<view class="brand-wrapper">
|
||||
<page-container show="{{show_page}}" round="{{round}}" overlay="{{overlay}}" duration="{{duration}}" position="{{position}}" z-index="1000" close-on-slide-down="{{false}}" bindbeforeenter="onBeforeEnter" bindenter="onEnter" bindafterenter="onAfterEnter" bindbeforeleave="onBeforeLeave" bindleave="onLeave" bindafterleave="onAfterLeave" bindclickoverlay="onClickOverlay" custom-style="{{customStyle}}" overlay-style="{{overlayStyle}}">
|
||||
<view class="detail-page fn-flex" style="flex-direction:column;">
|
||||
<view class="inner30">
|
||||
<view class="ulib-r20 bds-2-eb text-center pt15 pb15">
|
||||
<input placeholder="请输入品牌名" value="" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="list fn-flex-item relative">
|
||||
<view wx:if="{{list.length>0}}" class="absolute wp100 left-0 top-0 bottom-0 mb20">
|
||||
<scroll-view style="height:100%;" scroll-y="{{true}}">
|
||||
<block wx:for="{{list}}" wx:key="index">
|
||||
<view bindtap="bindSelectIndex" data-index="{{index}}" class="ml30 mr30">
|
||||
<view class="font-32 fn-flex fn-flex-middle fn-flex-between pt30 pb30 bbs-1-eb">
|
||||
<view style="transition: .2s all ease;" class="ml10 {{cur==index?'text-bold':''}}">{{item.name}}</view>
|
||||
<text style="transition: .2s all ease;" class="iconfont font-36 {{cur==index?'icon-danxuan_xuanzhong color-444':'icon-danxuan color-ccc'}}"></text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<!-- <view class="color-fff">请输入品牌名</view> -->
|
||||
<listmore wx:else isMiddle="{{true}}" noDataMsg="请输入品牌名" isNoData="{{true}}"></listmore>
|
||||
</view>
|
||||
<view class="pb40 pl80 pr80">
|
||||
<button class="btn btn-36afa2 color-fff" style="transition: .2s all ease;" hover-class="btn-36afa2-hover" bindtap="exit" disabled="{{!(cur>-1)}}">我选好了</button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</page-container>
|
||||
</view>
|
||||
@@ -0,0 +1,14 @@
|
||||
/* components/brandSelect/index.wxss */
|
||||
@import "../../commons/css/common.wxss";
|
||||
.detail-page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 300rpx;
|
||||
/* display: flex;
|
||||
align-items: center;
|
||||
justify-content: center; */
|
||||
/* position:fixed;
|
||||
z-index: 1;
|
||||
left: 0;
|
||||
top: 0; */
|
||||
}
|
||||
Reference in New Issue
Block a user