Commit c8e8f007 by 杨明

Merge branch 'SAAS+V4.51.1-0415' of http://192.168.3.233:8090/saas_plus/dj-car-b…

…outique-work-wechat into SAAS+V4.51.1-0415
2 parents c9b7d4d5 9473836e
......@@ -6,7 +6,8 @@ Page({
*/
data: {
inputHeight: 0,
searchValue: ''
searchValue: '',
scrollTop: 0
},
/**
......@@ -170,6 +171,11 @@ Page({
page.changeCarBrand && page.changeCarBrand(item)
})
},
scroll(e) {
this.setData({
scrollTop: e.detail.scrollTop
})
},
search(e) {
try {
let {
......@@ -179,15 +185,22 @@ Page({
} = this.data
brandList.map(i => {
i.list.map(k => {
if (k.name.includes(value)) throw i.letter
if (k.name.includes(value)) throw k.id
})
})
} catch (letter) {
} catch (id) {
this.setData({
letter
letter: `brand-${id}`,
})
setTimeout(() => {
let {
scrollTop
} = this.data
this.setData({
scrollTopNum: scrollTop - 32
})
}, 200)
}
},
/**
* 生命周期函数--监听页面初次渲染完成
......
......@@ -2,7 +2,7 @@
<view class="car-brands-box">
<view class="car-brands">
<search-input bindsearch="search" value="{{searchValue}}" id="search-input" />
<scroll-view style="height:calc(100vh - {{inputHeight}}px);" scroll-y scroll-into-view="{{letter}}">
<scroll-view style="height:calc(100vh - {{inputHeight}}px);" scroll-y scroll-into-view="{{letter}}" scroll-top="{{scrollTopNum}}" bindscroll="scroll">
<block wx:if="{{flag}}">
<block wx:if="{{brandList.length}}">
<block wx:for="{{brandList}}" wx:key="index">
......@@ -10,7 +10,7 @@
<view class="title car-y-center">{{item.letter}}</view>
<view class="box">
<block wx:for="{{item.list}}" wx:for-item="i" wx:key="ind" wx:for-index="ind">
<view class="brands" catchtap="showCarSeries" data-item="{{i}}">
<view class="brands" catchtap="showCarSeries" data-item="{{i}}" id="brand-{{i.id}}">
<view class="list car-y-center">
<image src="{{i.logoUrl}}" class="icon" />
{{i.name}}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!