目录

@performance/hp-arkui-image-async-load

Use asynchronous loading for large images.

In common frame loss scenarios, modify the code according to this rule whenever possible.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@performance/hp-arkui-image-async-load": "suggestion",
  }
}

Options

This rule is not configurable.

Example of Correct Code

@Entry
@Component
struct MyComponent {
  build() {
    Row() {
      // Local image 4k.png
      Image($r('app.media.4k'))
        .border({ width: 1 })
        .borderStyle(BorderStyle.Dashed)
        .height(100)
        .width(100)
    }
  }
}

Example of Incorrect Code

@Entry
@Component
struct MyComponent {
  build() {
    Row() {
      // Local image 4k.png
      Image($r('app.media.4k'))
        .border({ width: 1 })
        .borderStyle(BorderStyle.Dashed)
        .height(100)
        .width(100)
        .syncLoad(true)
    }
  }
}

Rule Set

plugin:@performance/all

For details about how to configure Code Linter check rules, see Code Linter.