diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/borderImage.gif b/zh-cn/application-dev/reference/arkui-ts/figures/borderImage.gif
index dd8d0f1a9f9a786de94abf348130c526ecb09641..b3a316a22239c267af5503df959116dae4614338 100644
Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/borderImage.gif and b/zh-cn/application-dev/reference/arkui-ts/figures/borderImage.gif differ
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md
index ee1b03d2927828a14f2a9624ae16061b11cce4b9..9cc2c9747a0c6e1333d4e95a47aec3dc828f0361 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md
@@ -16,14 +16,14 @@
该接口支持在ArkTS卡片中使用。
-| 名称 | 类型 | 描述 |
-| ------ | ---------------------------------------- | ---------------------------------------- |
+| 名称 | 类型 | 描述 |
+| ------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| source | string \| [Resource](ts-types.md#resource) \| [linearGradient](ts-universal-attributes-gradient-color.md) | 边框图源或者渐变色设置。
**说明:**
边框图源仅适用于容器组件,如Row、Column、Flex,在非容器组件上使用会失效。 |
-| slice | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | 设置图片边框切割宽度。
默认值:0 |
-| width | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | 设置图片边框宽度。
默认值:0 |
-| outset | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | 设置边框图片向外延伸距离。
默认值:0 |
-| repeat | [RepeatMode](#repeatmode枚举说明) | 设置边框图片的重复方式。
默认值:RepeatMode.Stretch |
-| fill | boolean | 设置边框图片中心填充。
默认值:false |
+| slice | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | 设置边框图片左上角、右上角、左下角以及右下角的切割宽度。
默认值:0
**说明:**
设置负数时取默认值。
参数类型为[Length](ts-types.md#length)时,统一设置四个角的宽高。
参数为[EdgeWidths](ts-types.md#edgewidths9)时:
- Top:设置图片左上角或者右上角被切割的高。
- Bottom:设置图片左下角或者右下角被切割的高。
- Left:设置图片左上角或者左下角被切割的宽。
- Right:设置图片右上角或者右下角被切割的宽。 |
+| width | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | 设置图片边框宽度。
默认值:0
**说明:**
参数类型为[Length](ts-types.md#length)时,统一设置四个角的宽高,设置负数时取默认值。
参数为[EdgeWidths](ts-types.md#edgewidths9)时:
- Top:设置图片边框上边框的宽。
- Bottom:设置图片边框下边框的宽。
- Left:设置图片边框左边框的宽。
- Right:设置图片边框右边框宽。
设置负数时值取1。 |
+| outset | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | 设置边框图片向外延伸距离。
默认值:0
**说明:**
设置负数时取默认值。
参数类型为[Length](ts-types.md#length)时,统一设置四个角的宽高。
参数为[EdgeWidths](ts-types.md#edgewidths9)时:
- Top:设置边框图片上边框向外延伸的距离。
- Bottom:设置边框图片下边框向外延伸的距离。
- Left:设置边框图片左边框向外延伸的距离。
- Right:设置边框图片右边框向外延伸的距离。 |
+| repeat | [RepeatMode](#repeatmode枚举说明) | 设置被切割的图片在边框上的重复方式。
默认值:RepeatMode.Stretch |
+| fill | boolean | 设置边框图片中心填充。
默认值:false |
## RepeatMode枚举说明
@@ -77,35 +77,88 @@ struct Index {
// xxx.ets
@Entry
@Component
-struct Index {
- @State outSetValue: number = 40
+struct BorderImage {
+ @State WidthValue: number = 0
+ @State SliceValue: number = 0
+ @State OutSetValue: number = 0
+ @State RepeatValue: RepeatMode[] = [RepeatMode.Repeat, RepeatMode.Stretch, RepeatMode.Round, RepeatMode.Space]
+ @State SelectIndex: number = 0
+ @State SelectText: string = 'Repeat'
+ @State FillValue: boolean = false
build() {
Row() {
- Column() {
+ Column({ space: 20 }) {
Row() {
Text('This is borderImage.').textAlign(TextAlign.Center).fontSize(50)
}
.borderImage({
source: $r('app.media.icon'),
- slice: `${this.outSetValue}%`,
- width: `${this.outSetValue}px`,
- outset: '5px',
- repeat: RepeatMode.Repeat,
- fill: false
+ slice: this.SliceValue,
+ width: this.WidthValue,
+ outset: this.OutSetValue,
+ repeat: this.RepeatValue[this.SelectIndex],
+ fill: this.FillValue
})
- Slider({
- value: this.outSetValue,
- min: 0,
- max: 100,
- style: SliderStyle.OutSet
- })
- .margin({ top: 30 })
- .onChange((value: number, mode: SliderChangeMode) => {
- this.outSetValue = value
- console.info('value:' + value + 'mode:' + mode.toString())
+ Column() {
+ Text(`borderImageSlice = ${this.SliceValue}px`)
+ Slider({
+ value: this.SliceValue,
+ min: 0,
+ max: 100,
+ style: SliderStyle.OutSet
+ })
+ .onChange((value: number, mode: SliderChangeMode) => {
+ this.SliceValue = value
+ })
+ }
+
+ Column() {
+ Text(`borderImageWidth = ${this.WidthValue}px`)
+ Slider({
+ value: this.WidthValue,
+ min: 0,
+ max: 100,
+ style: SliderStyle.OutSet
+ })
+ .onChange((value: number, mode: SliderChangeMode) => {
+ this.WidthValue = value
+ })
+ }
+
+ Column() {
+ Text(`borderImageOutSet = ${this.OutSetValue}px`)
+ Slider({
+ value: this.OutSetValue,
+ min: 0,
+ max: 100,
+ style: SliderStyle.OutSet
})
+ .onChange((value: number, mode: SliderChangeMode) => {
+ this.OutSetValue = value
+ })
+ }
+
+ Row() {
+ Text('borderImageRepeat: ')
+ Select([{ value: 'Repeat' }, { value: 'Stretch' }, { value: 'Round' }, { value: 'Space' }])
+ .value(this.SelectText)
+ .selected(this.SelectIndex)
+ .onSelect((index: number, text: string) => {
+ this.SelectIndex = index
+ this.SelectText = text
+ })
+ }
+
+ Row() {
+ Text(`borderImageFill: ${this.FillValue} `)
+ Toggle({ type: ToggleType.Switch, isOn: this.FillValue })
+ .onChange((isOn: boolean) => {
+ this.FillValue = isOn
+ })
+ }
+
}
.width('100%')
}
@@ -114,4 +167,4 @@ struct Index {
}
```
-
\ No newline at end of file
+
\ No newline at end of file