增加选择品牌组件

This commit is contained in:
maclien
2024-07-17 23:39:00 +08:00
parent 7134915fbc
commit 68c7d5d698
8 changed files with 194 additions and 1 deletions
+129
View File
@@ -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
})
}
}
})
+6
View File
@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"listmore": "/components/listMore/index"
}
}
+32
View File
@@ -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>
+14
View File
@@ -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; */
}
+7
View File
@@ -11,6 +11,7 @@ Page({
text: '验证码',
pageshow: false,
imgUrl: _.config.imgUrl,
brand_page_show: false
},
onLoad: function (options) {
@@ -157,4 +158,10 @@ Page({
}
},
bindShowBrand(){
this.setData({
brand_page_show: true
})
}
})
+1
View File
@@ -5,5 +5,6 @@
"backgroundColor": "#ffffff",
"backgroundColorTop": "#1a1c26",
"usingComponents": {
"brandSelect": "/components/brandSelect/index"
}
}
+4
View File
@@ -39,7 +39,11 @@
</view>
-->
</view>
<!-- <button bindtap="bindShowBrand">1111</button> -->
<!-- <brandSelect show="{{brand_page_show}}"></brandSelect> -->
</view>
<lcb-footer></lcb-footer>
<!-- <kefuSuccess isHasClose="true" isShow="{{iskefuSuccess}}"></kefuSuccess> -->
+1 -1
View File
@@ -1,7 +1,7 @@
{
"appid": "wx4733380c110313ec",
"compileType": "miniprogram",
"libVersion": "3.0.0",
"libVersion": "latest",
"packOptions": {
"ignore": [],
"include": []