未验证 提交 c8f28a49 编写于 作者: O openharmony_ci 提交者: Gitee

!6846 fix border image code example error

Merge pull request !6846 from xiexiyun/borderImage
...@@ -43,13 +43,10 @@ ...@@ -43,13 +43,10 @@
@Entry @Entry
@Component @Component
struct Index { struct Index {
@State message: string = 'This is\nborderImage.'
@State message2: string = 'This is\ngradient color.'
build() { build() {
Row() { Row() {
Column() { Column() {
Text(this.message).textAlign(TextAlign.Center) Text('This is\nborderImage.').textAlign(TextAlign.Center)
.borderImage({ .borderImage({
source: "borderOrigin.png", source: "borderOrigin.png",
slice: {top:"31%", bottom:"31%", left:"31%", right:"31%"}, slice: {top:"31%", bottom:"31%", left:"31%", right:"31%"},
...@@ -58,8 +55,26 @@ struct Index { ...@@ -58,8 +55,26 @@ struct Index {
repeat: RepeatMode.Repeat, repeat: RepeatMode.Repeat,
fill: false fill: false
}); });
Text(this.message2).textAlign(TextAlign.Center) }
.margin(10) .width('100%')
}
.height('100%')
}
}
```
![zh-cn_image_borderImage](figures/borderImage.png)
```ts
// xxx.ets
@Entry
@Component
struct Index {
build() {
Row() {
Column() {
Text('This is\ngradient color.').textAlign(TextAlign.Center)
.borderImage({ .borderImage({
source: {angle:90, source: {angle:90,
direction: GradientDirection.Left, direction: GradientDirection.Left,
...@@ -77,4 +92,4 @@ struct Index { ...@@ -77,4 +92,4 @@ struct Index {
} }
``` ```
![zh-cn_image_borderImage](figures/borderImage.png) ![zh-cn_image_borderImageGradient](figures/borderImageGradient.png)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册