source stringlengths 14 113 | code stringlengths 10 21.3k |
|---|---|
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-overlay.md | // xxx.ets
@Entry
@Component
struct OverlayExample {
build() {
Column() {
Column() {
Text('floating layer')
.fontSize(12).fontColor(0xCCCCCC).maxLines(1)
Column() {
Image($r('app.media.img'))
.width(240).height(240)
.overlay("Winter is a beautiful ... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-overlay.md | // xxx.ets
@Entry
@Component
struct OverlayExample {
@Builder OverlayNode() {
Column() {
Image($r('app.media.img1'))
Text("This is overlayNode").fontSize(20).fontColor(Color.White)
}.width(180).height(180).alignItems(HorizontalAlign.Center)
}
build() {
Column() {
Image($r('app.media... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-overlay.md | // xxx.ets
import { ComponentContent } from '@kit.ArkUI';
class Params{
backgroundColor: string | Resource = ""
constructor(backgroundColor: string | Resource) {
this.backgroundColor = backgroundColor;
}
}
@Builder
function overlayBuilder(params: Params){
Row(){
}.width('100%').height('100%').background... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-pixelRound.md | @Entry
@Component
struct PixelRoundExample {
@State curWidth : number = 300;
build() {
Column() {
Button(){
Text(this.curWidth.toString())
}
.onClick(() => {
this.curWidth += 0.1;
})
.height(200)
.wi... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-point-light-style-sys.md | // xxx.ets
@Entry
@Component
struct Index {
@State lightIntensity: number = 0;
@State bloomValue: number = 0;
build() {
Row({ space: 20 }) {
Flex()
.pointLight({ illuminated: IlluminatedType.BORDER })
.backgroundColor(0x307af7)
.size({ width: 50, height: 50 })
.borderRad... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-polymorphic-style.md | // xxx.ets
@Entry
@Component
struct StyleExample {
@State isEnable: boolean = true
@Styles pressedStyles():void {
.backgroundColor("#ED6F21")
.borderRadius(10)
.borderStyle(BorderStyle.Dashed)
.borderWidth(2)
.borderColor("#33000000")
.width(120)
.height(30)
.opacity(1)
}
@Styl... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-polymorphic-style.md | // xxx.ets
@Entry
@Component
struct Index {
@State value: boolean = false
@State value2: boolean = false
@Styles
normalStyles(): void{
.backgroundColor("#E5E5E1")
}
@Styles
selectStyles(): void{
.backgroundColor("#ED6F21")
.borderWidth(2)
}
build() {
Flex({ direction: FlexDirection.... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-popup.md | // xxx.ets
@Entry
@Component
struct PopupExample {
@State handlePopup: boolean = false;
@State customPopup: boolean = false;
// Popup builder
@Builder popupBuilder() {
Row({ space: 2 }) {
Image($r("app.media.icon")).width(24).height(24).margin({ left: -5 })
Text('Custom Popup').fontSize(10)
... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-popup.md | // xxx.ets
@Entry
@Component
struct PopupExample {
@State handlePopup: boolean = false;
build() {
Column({ space: 100 }) {
Button('PopupOptions').margin(100)
.onClick(() => {
this.handlePopup = !this.handlePopup;
})
.bindPopup(this.handlePopup, {
// Popup of t... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-popup.md | // xxx.ets
@Entry
@Component
struct PopupExample {
@State customPopup: boolean = false;
@State handlePopup: boolean = false;
build() {
Column({ space: 100 }) {
Button("popup")
.margin({ top: 50 })
.onClick(() => {
this.customPopup = !this.customPopup;
})
.bind... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-popup.md | // xxx.ets
@Entry
@Component
struct PopupExample {
@State handlePopup: boolean = false;
@State customPopup: boolean = false;
// Popup builder
@Builder popupBuilder() {
Row() {
Text('Custom Popup with transitionEffect').fontSize(10)
}.height(50).padding(5)
}
build() {
Flex({ direction: Fl... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-popup.md | // xxx.ets
@Entry
@Component
struct PopupExample {
@State handlePopup: boolean = false;
build() {
Column() {
Button('PopupOptions')
.onClick(() => {
this.handlePopup = true;
})
.bindPopup(this.handlePopup, {
message: 'This is a popup with PopupOptions',
... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-popup.md | // xxx.ets
@Entry
@Component
struct PopupExample {
@State handlePopup: boolean = false;
build() {
Column() {
Button('PopupOptions')
.onClick(() => {
this.handlePopup = true;
})
.bindPopup(this.handlePopup, {
message: 'This is a popup with PopupOptions',
... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-renderfit.md | // xxx.ets
@Entry
@Component
struct RenderFitExample {
@State width1: number = 100;
@State height1: number = 30;
flag: boolean = true;
build() {
Column() {
Text("Hello")
.width(this.width1)
.height(this.height1)
.borderWidth(1)
.textAlign(TextAlign.Start)
.rend... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-restoreId.md | // xxx.ets
@Entry
@Component
struct RestoreIdExample {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
build() {
Column() {
List({ space: 20 }) {
ForEach(this.arr, (item:number) => {
ListItem() {
Text('' + item)
.width('100%')
.height(10... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-reuse-id.md | // xxx.ets
@Entry
@Component
struct MyComponent {
@State switch: boolean = true;
private type: string = "type1";
build() {
Column() {
Button("ChangeType")
.onClick(() => {
this.type = "type2"
})
Button("Switch")
.onClick(() => {
this.switch = !this.swit... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-reuse.md | @Entry
@ComponentV2
struct Index {
build() {
Column() {
ReusableV2Component()
.reuse({reuseId: () => 'reuseComponent'}) // Use 'reuseComponent' as reuseId.
ReusableV2Component()
.reuse({reuseId: () => ''}) // If an empty string is used, the component name 'ReusableV2Component' is used ... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-sharp-clipping.md | // xxx.ets
import { CircleShape, RectShape } from '@kit.ArkUI'
@Entry
@Component
struct ClipAndMaskExample {
build() {
Column({ space: 15 }) {
Text('clip').fontSize(12).width('75%').fontColor('#DCDCDC')
Row() {
Image($r('app.media.testImg')).width('500px').height('280px')
}
.clip(... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-sharp-clipping.md | @Entry
@Component
struct ProgressMaskExample {
@State progressflag1: boolean = true;
@State color: Color = 0x01006CDE;
@State value: number = 10.0;
@State enableBreathingAnimation: boolean = false;
@State progress: ProgressMask = new ProgressMask(10.0, 100.0, Color.Gray);
build() {
Column({ space: 15 }... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-sheet-transition.md | // xxx.ets
@Entry
@Component
struct SheetTransitionExample {
@State isShow: boolean = false
@State sheetHeight: number = 300;
@Builder
myBuilder() {
Column() {
Button("change height")
.margin(10)
.fontSize(20)
.onClick(() => {
this.sheetHeight = 500;
})
... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-sheet-transition.md | // xxx.ets
@Entry
@Component
struct SheetTransitionExample {
@State isShow: boolean = false
@Builder
myBuilder() {
Column() {
Button("content1")
.margin(10)
.fontSize(20)
Button("content2")
.margin(10)
.fontSize(20)
}
.width('100%')
}
build() {
Co... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-sheet-transition.md | // xxx.ets
import { LengthMetrics } from '@kit.ArkUI'
@Entry
@Component
struct SheetTransitionExample {
@State isShow: boolean = false
@Builder
myBuilder() {
Column() {
Button("content1")
.margin(10)
.fontSize(20)
Button("content2")
.margin(10)
.fontSize(20)
... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-sheet-transition.md | // xxx.ets
@Entry
@Component
struct bindSheetExample {
@State isShow: Boolean = false;
@Builder
myBuilder() {
Column() {
Button() {
Text("CONTEXT")
}.height(50)
}
}
build() {
Column() {
Button("NoRegisterSpringback")
.onClick(() => {
this.isShow = true... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-sheet-transition.md | // xxx.ets
@Entry
@Component
struct Index {
@State isShow: boolean = false;
@Builder
myBuilder() {
Column() {
Column()
.backgroundColor(Color.Blue)
.height(200)
.width('100%')
Column()
.backgroundColor(Color.Green)
.height(200)
.width('100%')
}
... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-sheet-transition.md | //xxx.ets
import window from '@ohos.window';
import { BusinessError } from '@ohos.base';
@Entry
@Component
struct ListenKeyboardHeightChange {
@State isShow: boolean = false;
@State avoidMode: SheetKeyboardAvoidMode = SheetKeyboardAvoidMode.RESIZE_ONLY;
scroller = new Scroller();
private arr: number[] = [0, 1,... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-sheet-transition.md | import { LengthMetrics } from '@kit.ArkUI';
@Entry
@Component
struct SheetTransitionExample {
@State isShow: boolean = false
@Builder
myBuilder() {
Column() {
Button("content1")
.margin(10)
.fontSize(20)
Button("content2")
.margin(10)
.fontSize(20)
}
.wid... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-size.md | // xxx.ets
@Entry
@Component
struct SizeExample {
build() {
Column({ space: 10 }) {
Text('margin and padding:').fontSize(12).fontColor(0xCCCCCC).width('90%')
Row() {
// Width: 80; height: 80; margin: 20 (blue area); top, bottom, left, and right paddings: 5, 15, 10, and 20 (white area)
... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-size.md | // xxx.ets
import { LengthMetrics } from '@kit.ArkUI'
@Entry
@Component
struct SizeExample {
build() {
Column({ space: 10 }) {
Text('margin and padding:').fontSize(12).fontColor(0xCCCCCC).width('90%')
Row() {
// Set the width to 80, height to 80, top, bottom, start, and end paddings to 40, 20... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-size.md | // xxx.ets
import { LengthMetrics } from '@kit.ArkUI';
@Entry
@Component
struct SafeAreaPaddingExample {
build() {
Column() {
Column() {
Column()
.width("100%")
.height("100%")
.backgroundColor(Color.Pink)
}
.width(200)
.height(200)
.backgroundC... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-text-style.md | // xxx.ets
@Entry
@Component
struct TextStyleExample {
build() {
Column({ space: 8 }) {
Text('default text')
Text('text font color red').fontColor(Color.Red)
Text('text font default')
Text('text font size 10').fontSize(10)
Text('text font size 10fp').fontSize('10fp')
... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-tips.md | // xxx.ets
@Entry
@Component
struct TipsExample {
build() {
Flex({ direction: FlexDirection.Column }) {
Button('Hover Tips')
.bindTips("test Tips", {
appearingTime: 700,
disappearingTime: 300,
appearingTimeWithContinuousOperation: 300,
disappearingTimeWithCont... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-tips.md | // xxx.ets
@Entry
@Component
struct TipsExample {
build() {
Flex({ direction: FlexDirection.Column }) {
Button('Hover Tips')
.bindTips("test Tips", {
appearingTime: 700,
disappearingTime: 300,
appearingTimeWithContinuousOperation: 300,
disappearingTimeWithCon... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-toolbar.md | // xxx.ets
@Entry
@Component
struct SideBarContainerExample {
normalIcon: Resource = $r("app.media.startIcon")
selectedIcon: Resource = $r("app.media.startIcon")
@State arr: number[] = [1, 2, 3]
@State current: number = 1
@Provide('navPathStack') navPathStack: NavPathStack = new NavPathStack()
@Builder
M... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-touch-target.md | // xxx.ets
@Entry
@Component
struct TouchTargetExample {
@State text: string = ""
build() {
Column({ space: 20 }) {
Text("{x:0,y:0,width:'50%',height:'100%'}")
// The width of the touch target is half of that of the button. The user will get no response if they touch the right of the button.
... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-transformation.md | // xxx.ets
import { matrix4 } from '@kit.ArkUI';
@Entry
@Component
struct TransformExample {
build() {
Column() {
Text('rotate').width('90%').fontColor(0xCCCCCC).padding(15).fontSize(14)
Row()
.rotate({
x: 0,
y: 0,
z: 1,
centerX: '50%',
center... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-transformation.md | // xxx.ets
@Entry
@Component
struct Index {
@State prep: number = 10;
build() {
Row() {
Column() {
Stack()
.width(100)
.height(100)
.backgroundColor(Color.Red)
.rotate({ y: 1, angle: 45, perspective: this.prep })
Button('change prep')
.mar... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-transformation.md | import { matrix4 } from '@kit.ArkUI'
@Entry
@Component
struct MatrixExample {
build() {
Column({ space: 100 }) {
Text('Hello1')
.textAlign(TextAlign.Center)
.width(100)
.height(60)
.borderWidth(1)
Text('Hello2')
.textAlign(TextAlign.Center)
.width(100)... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-use-effect.md | //Index.ets
@Entry
@Component
struct Index {
@State isUse: boolean = true;
build() {
Stack() {
Image($r("app.media.mountain"))
.autoResize(true)
EffectComponent() {
Column({ space: 20 }) {
Column() {
}
.position({ x: 0, y: 0 })
.width(150)... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-visibility.md | // xxx.ets
@Entry
@Component
struct VisibilityExample {
build() {
Column() {
Column() {
// The component is hidden and does not take up space in the layout.
Text('None').fontSize(9).width('90%').fontColor(0xCCCCCC)
Row().visibility(Visibility.None).width('90%').height(80).backgroundC... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-z-order.md | // xxx.ets
@Entry
@Component
struct ZIndexExample {
build() {
Column() {
Stack() {
// Components are stacked. By default, the component defined later is on the top. A component with a larger zIndex value is displayed before one with a smaller zIndex value.
Text('1, zIndex(2)')
.siz... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-attributes-z-order.md | // xxx.ets
@Entry
@Component
struct ZIndexExample {
@State zIndex_ : number = 0
build() {
Column() {
// Clicking the Button component changes the zIndex value. Components are sorted stably based on their previous stacking order.
Button("change Text2 zIndex")
.onClick(()=>{
this.zIn... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-component-area-change-event.md | // xxx.ets
@Entry
@Component
struct AreaExample {
@State value: string = 'Text'
@State sizeValue: string = ''
build() {
Column() {
Text(this.value)
.backgroundColor(Color.Green)
.margin(30)
.fontSize(20)
.onClick(() => {
this.value = this.value + 'Text'
... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-component-size-change-event.md | // xxx.ets
@Entry
@Component
struct AreaExample {
@State value: string = 'Text'
@State sizeValue: string = ''
build() {
Column() {
Text(this.value)
.backgroundColor(Color.Green)
.margin(30)
.fontSize(20)
.onClick(() => {
this.value = this.value + 'Text'
... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-component-visible-area-change-event.md | // xxx.ets
@Entry
@Component
struct ScrollExample {
scroller: Scroller = new Scroller()
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
@State testTextStr: string = 'test'
@State testRowStr: string = 'test'
build() {
Column() {
Column() {
Text(this.testTextStr)
.fontSize(20... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-component-visible-area-change-event.md | // xxx.ets
@Entry
@Component
struct ScrollExample {
scroller: Scroller = new Scroller()
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
@State testTextStr: string = 'test'
@State testRowStr: string = 'test'
build() {
Column() {
Column() {
Text(this.testTextStr)
.fontSize(20... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-axis.md | // xxx.ets
@Entry
@Component
struct AxisEventExample {
@State text: string = ''
build() {
Column() {
Row({ space: 20 }) {
Button('AxisEvent').width(100).height(40)
.onAxisEvent((event?: AxisEvent) => {
if (event) {
this.text =
'AxisEvent:' + '\n... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-click.md | // xxx.ets
@Entry
@Component
struct ClickExample {
@State text: string = ''
build() {
Column() {
Row({ space: 20 }) {
Button('Click').width(100).height(40).id('click')
.onClick((event?: ClickEvent) => {
if(event){
this.text = 'Click Point:' + '\n windowX:' + e... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-crown.md | // xxx.ets
@Entry
@Component
struct CityList {
@State message: string = "onDigitalCrown";
build() {
Column() {
Row(){
Stack() {
Text(this.message)
.fontSize(20)
.fontColor(Color.White)
.backgroundColor("#262626")
.textAlign(TextAlign.Cente... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-drag-drop.md | // xxx.ets
import { unifiedDataChannel, uniformTypeDescriptor } from '@kit.ArkData';
import { promptAction } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct Index {
@State targetImage: string = '';
@State targetText: string = 'Drag Text';
@State imageWidth: numb... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-drag-drop.md | import { unifiedDataChannel, uniformTypeDescriptor } from '@kit.ArkData';
import { promptAction } from '@kit.ArkUI';
@Entry
@Component
struct DropAnimationExample {
@State targetImage: string = '';
@State targetText: string = 'Drag Text';
@State hyperLinkText: string = 'HyperLink';
@State hyperLinkContent: st... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-drag-drop.md | import { unifiedDataChannel, uniformTypeDescriptor } from '@kit.ArkData';
import { fileUri, fileIo as fs } from '@kit.CoreFileKit'
import { common } from '@kit.AbilityKit'
@Entry
@Component
struct ImageExample {
@State uri: string = "";
@State blockArr: string[] = [];
udKey: string = '';
build() {
Column(... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-focus_axis.md | // xxx.ets
@Entry
@Component
struct FocusAxisEventExample {
@State text: string = ''
@State axisValue: string = ''
aboutToAppear(): void {
this.getUIContext().getFocusController().activate(true)
}
aboutToDisappear(): void {
this.getUIContext().getFocusController().activate(false)
}
build() {
... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-hover.md | // xxx.ets
@Entry
@Component
struct HoverEventExample {
@State hoverText: string = 'no hover';
@State color: Color = Color.Blue;
build() {
Column({ space: 20 }) {
Button(this.hoverText)
.width(180).height(80)
.backgroundColor(this.color)
.onHover((isHover: boolean, event: HoverE... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-hover.md | // xxx.ets
@Entry
@Component
struct OnHoverMoveEventExample {
@State hoverMoveText: string = '';
build() {
Column({ space: 20 }) {
Button('onHoverMove')
.width(180).height(80)
.onHoverMove((event: HoverEvent) => {
this.hoverMoveText = 'onHoverMove:\nXY = (' + event.x + ', ' + ev... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-key.md | // xxx.ets
@Entry
@Component
struct KeyEventExample {
@State text: string = ''
@State eventType: string = ''
build() {
Column() {
Button('KeyEvent')
.onKeyEvent((event?: KeyEvent) => {
if(event){
if (event.type === KeyType.Down) {
this.eventType = 'Down'
... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-key.md | // xxx.ets
@Entry
@Component
struct KeyEventExample {
@State text: string = ''
@State eventType: string = ''
@State keyType: string = ''
build() {
Column({ space: 10 }) {
Button('KeyEvent')
.onKeyEvent((event?: KeyEvent) => {
if(event){
if (event.type === KeyType.Down) {... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-key.md | import { KeyCode } from '@kit.InputKit';
@Entry
@Component
struct PreImeEventExample {
@State buttonText: string = '';
@State buttonType: string = '';
@State columnText: string = '';
@State columnType: string = '';
build() {
Column() {
Search({
placeholder: "Search..."
})
.wi... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-keyboardshortcut.md | @Entry
@Component
struct Index {
@State message: string = 'Hello World'
build() {
Row() {
Column({ space: 5 }) {
Text(this.message)
Button("Test short cut 1").onClick((event: ClickEvent) => {
this.message = "I clicked Button 1";
console.log("I clicked 1");
}).k... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-keyboardshortcut.md | @Entry
@Component
struct Index {
@State message: string = 'disable'
@State shortCutEnable: boolean = false
@State keyValue: string = ''
build() {
Row() {
Column({ space: 5 }) {
Text('Ctrl+A is ' + this.message)
Button("Test short cut").onClick((event: ClickEvent) => {
this.m... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-show-hide.md | // xxx.ets
import { promptAction } from '@kit.ArkUI'
@Entry
@Component
struct AppearExample {
@State isShow: boolean = true
@State changeAppear: string = 'Show/Hide'
private myText: string = 'Text for onAppear'
build() {
Column() {
Button(this.changeAppear)
.onClick(() => {
this.is... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-events-touch.md | // xxx.ets
@Entry
@Component
struct TouchExample {
@State text: string = ''
@State eventType: string = ''
build() {
Column() {
Button('Touch').height(40).width(100)
.onTouch((event?: TouchEvent) => {
if(event){
if (event.type === TouchType.Down) {
this.eventT... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-focus-event.md | // xxx.ets
@Entry
@Component
struct FocusEventExample {
@State oneButtonColor: string = '#FFC0CB'
@State twoButtonColor: string = '#87CEFA'
@State threeButtonColor: string = '#90EE90'
build() {
Column({ space: 20 }) {
// You can use the up and down arrow keys on an external keyboard to move the focus... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-mouse-key.md | // xxx.ets
@Entry
@Component
struct MouseEventExample {
@State hoverText: string = 'no hover';
@State mouseText: string = '';
@State action: string = '';
@State mouseBtn: string = '';
@State color: Color = Color.Blue;
build() {
Column({ space: 20 }) {
Button(this.hoverText)
.width(180).he... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-styled-string-sys.md | // xxx.ets
import { LengthMetrics } from '@kit.ArkUI'
@Entry
@Component
struct Index {
@State textTitle: string = "Marshalling and unmarshalling APIs"
@State textResult: string = "Hello world"
@State serializeStr: string = "Marshalling"
@State flag: boolean = false
private textAreaController: TextAreaControl... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-styled-string-sys.md | enum MyUserDataType {
TYPE1 = 0,
TYPE2
}
class MyUserData extends UserDataSpan {
constructor(){
super()
}
marshalling() {
console.log("MyUserData marshalling...")
const text = "MyUserData1";
const buffer = new ArrayBuffer(text.length + 1);
const uint8View = new Uint8Array(buffer);
// ... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-styled-string.md | // xxx.ets
@Entry
@Component
struct styled_string_demo1 {
@State height1: number = 450;
@State fontSize1: number = 16;
@State fontWeight1: number = 400;
@State color1: Color = Color.Blue;
scroll: Scroller = new Scroller();
fontStyleAttr1: TextStyle = new TextStyle({ fontColor: Color.Blue });
fontStyleAttr... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-styled-string.md | // xxx.ets
import { promptAction } from '@kit.ArkUI';
@Entry
@Component
struct styled_string_demo2 {
scroll: Scroller = new Scroller();
fontStyleAttr1: TextStyle = new TextStyle({ fontColor: Color.Blue });
clickGestureAttr: GestureStyle = new GestureStyle({
onClick: () => {
promptAction.showToast({ mes... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-styled-string.md | // xxx.ets
import { LengthMetrics, LengthUnit } from '@kit.ArkUI'
@Entry
@Component
struct styled_string_demo3 {
fontStyleAttr1: TextStyle = new TextStyle({ fontColor: Color.Blue });
fontStyleAttr2: StyledStringValue = new TextStyle({
fontColor: Color.Orange,
fontSize: LengthMetrics.vp(20),
fontWeight:... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-styled-string.md | // xxx.ets
import { image } from '@kit.ImageKit'
import { LengthMetrics } from '@kit.ArkUI'
@Entry
@Component
struct styled_string_demo4 {
@State message: string = 'Hello World'
imagePixelMap: image.PixelMap | undefined = undefined
@State imagePixelMap3: image.PixelMap | undefined = undefined
mutableStr: Mutab... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-styled-string.md | import { LengthMetrics } from '@kit.ArkUI'
const canvasWidth = 1000
const canvasHeight = 100
class LeadingMarginCreator {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private offscreenCanvas: OffscreenCanvas = new OffscreenCanvas(canvasWidth, canvasHeight)
private offContext: Of... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-styled-string.md | // xxx.ets
import { drawing } from '@kit.ArkGraphics2D'
import { LengthMetrics } from '@kit.ArkUI'
class MyCustomSpan extends CustomSpan {
constructor(word: string, width: number, height: number) {
super();
this.word = word;
this.width = width;
this.height = height;
}
onMeasure(measureInfo: Cust... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-styled-string.md | // xxx.ets
class MyUserDateSpan extends UserDataSpan {
constructor(name: string, age: number) {
super()
this.name = name
this.age = age
}
name: string
age: number
}
@Entry
@Component
struct styled_string_demo7 {
@State name: string = "world"
@State age: number = 10
controller: TextController... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-styled-string.md | // xxx.ets
import { image } from '@kit.ImageKit'
import { LengthMetrics } from '@kit.ArkUI'
@Entry
@Component
struct styled_string_demo8 {
imagePixelMap: image.PixelMap | undefined = undefined
@State html : string | undefined = undefined
@State styledString : StyledString | undefined = undefined
controller1 : ... |
application-dev\reference\apis-arkui\arkui-ts\ts-universal-styled-string.md | // xxx.ets
@Entry
@Component
struct styled_string {
urlString: StyledStringValue = new UrlStyle( "https://www.example.com" );
mutableStyledString: MutableStyledString = new MutableStyledString("Hello World", [{
start: 0,
length: "Hello".length,
styledKey: StyledStringKey.URL,
styledValue: this.urlSt... |
application-dev\reference\apis-arkweb\js-apis-webview.md | import { webview } from '@kit.ArkWeb'; |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
webview.once("webInited", () => {
console.log("configCookieSync");
webview.WebCookieManager.configCookieSync("https://www.example.com", "a=b");
})
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
ports: webview.WebMessagePort[] = [];
build() {
Column() {
Button('postMessageEvent'... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
ports: webview.WebMessagePort[] = [];
build() {
Column() {
Button('onMessageEvent')
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
class TestObj {
test(str: string): ArrayBuffer {
let buf = new ArrayBuffer(str.length);
let buff = new Uint8Array(buf);
for (let i = 0; i < str.length; i++) {
buff[i] = str.charCodeAt(i);
}... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
msgPort: webview.WebMessagePort[] = [];
build() {
Column() {
// Use createWebMessage... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
class WebObj {
constructor() {
}
webTest(): string {
console.log('Web test');
return "Web test";
}
webString(): void {
console.log('Web test toString');
}
}
@Entry
@Component
struct WebCo... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import { webview } from '@kit.ArkWeb';
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
console.log("EntryAbility onCreate")
webview.WebviewController.initializ... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
console.log("EntryAbi... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
aboutToAppear(): void {
try {
webview.WebviewController.setWebDebuggingAccess(true);
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('loadUrl')
.onClick(() => {
try {
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('loadUrl')
.onClick(() => {
try {
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('loadUrl')
.onClick(() => {
try {
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('loadUrl')
.onClick(() => {
try {
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('loadData')
.onClick(() => {
try {
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('loadData')
.onClick(() => {
try {
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
updataContent: string = '<body><div><image src=resource://rawfile/xxx.png alt="image -- end" widt... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('accessForward')
.onClick(() => {
try {
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('forward')
.onClick(() => {
try {
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('accessBackward')
.onClick(() => {
try {... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('backward')
.onClick(() => {
try {
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('onActive')
.onClick(() => {
try {
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('onInactive')
.onClick(() => {
try {
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('refresh')
.onClick(() => {
try {
... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
@State steps: number = 2;
build() {
Column() {
Button('accessStep')
.onClick... |
application-dev\reference\apis-arkweb\js-apis-webview.md | // xxx.ets
import { webview } from '@kit.ArkWeb';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct WebComponent {
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Button('clearHistory')
.onClick(() => {
try {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.