mirror of
https://gitee.com/openharmony/applications_app_samples
synced 2024-11-27 10:40:41 +00:00
Refresh offset、friction字段废弃
Signed-off-by: yeyedeshen <yangxin181@huawei.com>
This commit is contained in:
parent
9bc39c9590
commit
dd07de66d1
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -14,41 +14,12 @@
|
||||
*/
|
||||
|
||||
import { TitleBar } from '../../../../common/TitleBar'
|
||||
import { getStringData } from '../../../../data/ResourceDataHandle'
|
||||
|
||||
@Extend(Text) function leftTitleStyle() {
|
||||
.fontColor($r('app.color.sub_title_color'))
|
||||
.fontSize(14)
|
||||
.height(22)
|
||||
}
|
||||
|
||||
@Extend(Text) function subTitleStyle() {
|
||||
.fontColor($r('app.color.sub_title_color'))
|
||||
.fontSize(14)
|
||||
.height(22)
|
||||
}
|
||||
|
||||
@Extend(Column) function cardStyle() {
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(24)
|
||||
.width('100%')
|
||||
.padding(15)
|
||||
}
|
||||
|
||||
@Extend(ListItem) function itemCardStyle() {
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
.width('100%')
|
||||
.padding(10)
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct RefreshSample {
|
||||
@State counter: number = 0
|
||||
@State isRefreshing: boolean = false
|
||||
@State mOffset: number = 0
|
||||
@State mFriction: number = 62
|
||||
private dataArray: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
|
||||
@Builder refreshBuilder() {
|
||||
@ -66,7 +37,7 @@ struct RefreshSample {
|
||||
Column() {
|
||||
TitleBar({ title: $r('app.string.auxiliary_refresh') })
|
||||
Column() {
|
||||
Refresh({ refreshing: $$this.isRefreshing, offset: this.mOffset, friction: this.mFriction, builder:this.refreshBuilder }) {
|
||||
Refresh({ refreshing: $$this.isRefreshing, builder: this.refreshBuilder }) {
|
||||
Scroll() {
|
||||
Column() {
|
||||
ForEach(this.dataArray, (item: number) => {
|
||||
@ -82,54 +53,14 @@ struct RefreshSample {
|
||||
})
|
||||
}.width('100%')
|
||||
}.width('100%')
|
||||
.height(300)
|
||||
}
|
||||
.width('100%')
|
||||
.height(300)
|
||||
.onRefreshing(() => {
|
||||
setTimeout(() => {
|
||||
this.counter++
|
||||
this.isRefreshing = false
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
Blank(20)
|
||||
Column() {
|
||||
Text($r('app.string.auxiliary_refresh_offset'))
|
||||
.leftTitleStyle()
|
||||
.alignSelf(ItemAlign.Start)
|
||||
Row() {
|
||||
Text($r('app.string.auxiliary_refresh_minvalue'))
|
||||
.leftTitleStyle()
|
||||
Slider({ value: this.mOffset, min: 0, max: 100 })
|
||||
.onChange((value) => {
|
||||
this.mOffset = value
|
||||
})
|
||||
.layoutWeight(1)
|
||||
Text($r('app.string.auxiliary_refresh_maxvalue'))
|
||||
.leftTitleStyle()
|
||||
}.width('100%')
|
||||
.padding(12)
|
||||
}.cardStyle()
|
||||
|
||||
Blank(20)
|
||||
Column() {
|
||||
Text($r('app.string.auxiliary_refresh_friction'))
|
||||
.leftTitleStyle()
|
||||
.alignSelf(ItemAlign.Start)
|
||||
Row() {
|
||||
Text($r('app.string.auxiliary_refresh_minvalue'))
|
||||
.leftTitleStyle()
|
||||
Slider({ value: this.mFriction, min: 0, max: 100 })
|
||||
.onChange((value) => {
|
||||
this.mFriction = value
|
||||
})
|
||||
.layoutWeight(1)
|
||||
Text($r('app.string.auxiliary_refresh_maxvalue'))
|
||||
.leftTitleStyle()
|
||||
}.width('100%')
|
||||
.padding(12)
|
||||
}
|
||||
}.padding(12)
|
||||
}.backgroundColor($r('app.color.background_light_gray'))
|
||||
.height('100%')
|
||||
|
Loading…
Reference in New Issue
Block a user