yangchenggong1_wd

fix |> 搜索-热门搜索 布局单位 lpx 改成 vp

... ... @@ -171,7 +171,6 @@ export struct SearchComponent {
SearchHotsComponent({
onGetSearchRes: (item): void => this.getSearchHotResData(item),
percent: this.percent
})
}
}
... ... @@ -179,7 +178,7 @@ export struct SearchComponent {
.scrollBar(BarState.Off)
.width('100%')
.height('100%')
.padding({ left: `${this.calcHeight(31)}lpx`, right: `${this.calcHeight(31)}lpx` })
.padding({ left: 16, right: 16 })
} else {
if (this.hasChooseSearch) {
//搜索结果
... ...
... ... @@ -10,7 +10,6 @@ const TAG = "SearchHotsComponent"
export struct SearchHotsComponent{
@State searchHotsData:SearchHotContentItem[] = []
onGetSearchRes?: (item:string) => void;
@Prop percent:number = 1
aboutToAppear(){
//获取搜索热词
... ... @@ -35,22 +34,21 @@ export struct SearchHotsComponent{
if(this.searchHotsData.length>0){
Row() {
Image($r('app.media.search_hot_icon'))
.width(`${this.calcHeight(46)}lpx`)
.height(`${this.calcHeight(46)}lpx`)
.width(24)
.height(24)
.objectFit(ImageFit.Auto)
.margin({right:`${this.calcHeight(8)}lpx`})
.margin({right:4})
.interpolation(ImageInterpolation.Medium)
Text("热门搜索")
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Bold)
.fontSize(`${this.calcHeight(33)}lpx`)
.lineHeight(`${this.calcHeight(46)}lpx`)
.fontSize(17)
.fontColor($r('app.color.color_222222'))
.height(`${this.calcHeight(46)}lpx`)
.height(24)
}
.width('100%')
.margin({bottom:`${this.calcHeight(15)}lpx`})
.margin({bottom:8})
}
List(){
... ... @@ -61,49 +59,47 @@ export struct SearchHotsComponent{
Row(){
if(item.sequence <=3){
Image(item.sequence===1?$r('app.media.search_hot_num1'):item.sequence===2?$r('app.media.search_hot_num2'):$r('app.media.search_hot_num3'))
.width(`${this.calcHeight(27)}lpx`)
.height(`${this.calcHeight(35)}lpx`)
.width(14)
.height(18)
.objectFit(ImageFit.Auto)
.margin({right:`${this.calcHeight(12)}lpx`})
.margin({right:6})
.interpolation(ImageInterpolation.High)
}else {
Text(`${item.sequence}`)
.height(`${this.calcHeight(31)}lpx`)
.height(16)
.fontColor($r('app.color.color_666666'))
.fontSize(`${this.calcHeight(27)}lpx`)
.fontSize(14)
.fontWeight(FontWeight.Regular)
.lineHeight(`${this.calcHeight(31)}lpx`)
.margin({right:`${this.calcHeight(12)}lpx`})
.margin({right:6})
}
Text(`${item.hotEntry}`)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontColor($r('app.color.color_222222'))
.fontSize(`${this.calcHeight(31)}lpx`)
.fontSize(16)
.maxLines(1)
.fontWeight(FontWeight.Regular)
.lineHeight(`${this.calcHeight(42)}lpx`)
}.layoutWeight(1)
if(item.mark===1 || item.mark===2){
Image(item.mark===1?$r('app.media.search_hots_mark1'):$r('app.media.search_hots_mark2'))
.width(`${this.calcHeight(42)}lpx`)
.height(`${this.calcHeight(31)}lpx`)
.width(22)
.height(16)
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
}
}.alignItems(VerticalAlign.Center)
.height(`${this.calcHeight(84)}lpx`)
.height(44)
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
if(index != this.searchHotsData.length-1 ){
Divider()
.width('100%')
.height(`${this.calcHeight(1)}lpx`)
.height(1)
.color($r('app.color.color_F5F5F5'))
.strokeWidth(`${this.calcHeight(1)}lpx`)
.strokeWidth(1)
}
}.height(`${this.calcHeight(85)}lpx`)
}.height(45)
.width('100%')
.alignItems(HorizontalAlign.Start)
}
... ... @@ -118,10 +114,7 @@ export struct SearchHotsComponent{
}).layoutWeight(1)
}.width('100%')
.height('100%')
.margin({top:`${this.calcHeight(46)}lpx`})
.margin({top:24})
}
calcHeight(value:number): number{
return value * this.percent
}
}
\ No newline at end of file
... ...