Merge branch '3.x' of gitee.com:openharmony-tpc/ImageKnife into 3.x

This commit is contained in:
madixin 2024-05-05 16:37:03 +08:00
commit 400ba85a5d
2 changed files with 5 additions and 5 deletions

View File

@ -18,20 +18,20 @@ import { ImageKnifeComponent, ImageKnifeOption } from '@ohos/imageknife';
@Component @Component
struct ListPage { struct ListPage {
private datas: string[] = [] private data: string[] = []
@State ImageKnifeOption: ImageKnifeOption = { loadSrc: $r('app.media.startIcon')} @State ImageKnifeOption: ImageKnifeOption = { loadSrc: $r('app.media.startIcon')}
aboutToAppear(): void { aboutToAppear(): void {
for (let i = 0; i < 1000; i++) { for (let i = 0; i < 1000; i++) {
this.datas.push(i.toString()) this.data.push(i.toString())
} }
} }
build() { build() {
Row() { Row() {
List({ space: 10 }) { List({ space: 10 }) {
ForEach(this.datas, (item: string) => { ForEach(this.data, (item: string) => {
ImageKnifeComponent({ imageKnifeOption: this.ImageKnifeOption }).height(200).width(200) ImageKnifeComponent({ imageKnifeOption: this.ImageKnifeOption }).height(200).width(200)
}, (item: string) => item) }, (item: string) => item)
} }

View File

@ -16,7 +16,7 @@ export struct UserAvatar {
imgSizes: number = 1 imgSizes: number = 1
@State ImageKnifeOption: ImageKnifeOption = new ImageKnifeOption() @State ImageKnifeOption: ImageKnifeOption = new ImageKnifeOption()
@StorageProp('WeLink_Mob_fontSize_multiple') @Watch('updateImgSize') WeLink_Mob_fontSize_multiple: number = 0 @StorageProp('WeLink_Mob_fontSize_multiple') @Watch('updateImgSize') WeLink_Mob_fontSize_multiple: number = 0
scaleable: boolean = true; scalable: boolean = true;
@State calcImgSize: number = 100 @State calcImgSize: number = 100
aboutToAppear(): void { aboutToAppear(): void {
@ -25,7 +25,7 @@ export struct UserAvatar {
} }
setImageSize() { setImageSize() {
if (!this.scaleable) { if (!this.scalable) {
this.calcImgSize = this.imgSize this.calcImgSize = this.imgSize
} else if (this.WeLink_Mob_fontSize_multiple < 0.9) { } else if (this.WeLink_Mob_fontSize_multiple < 0.9) {
this.calcImgSize = this.imgSize * 0.9 this.calcImgSize = this.imgSize * 0.9