提交 88f26692 编写于 作者: Y yamila

update arkts-basic-ui-description

Signed-off-by: Nyamila <tianyu55@huawei.com>
上级 417b1185
...@@ -144,7 +144,7 @@ Text(`count: ${this.count}`) ...@@ -144,7 +144,7 @@ Text(`count: ${this.count}`)
... ...
Button('add counter') Button('add counter')
.onClick(this.myClickHandler) .onClick(this.myClickHandler.bind(this))
``` ```
### 子组件配置 ### 子组件配置
......
...@@ -223,7 +223,7 @@ ...@@ -223,7 +223,7 @@
.height('5%') .height('5%')
// 跳转按钮绑定onClick事件,点击时跳转到第二页 // 跳转按钮绑定onClick事件,点击时跳转到第二页
.onClick(() => { .onClick(() => {
router.push({ url: 'pages/second' }) router.pushUrl({ url: 'pages/second' })
}) })
} }
.width('100%') .width('100%')
......
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
.height('5%') .height('5%')
// 跳转按钮绑定onClick事件,点击时跳转到第二页 // 跳转按钮绑定onClick事件,点击时跳转到第二页
.onClick(() => { .onClick(() => {
router.push({ url: 'pages/Second' }) router.pushUrl({ url: 'pages/Second' })
}) })
} }
.width('100%') .width('100%')
......
...@@ -125,16 +125,16 @@ ...@@ -125,16 +125,16 @@
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt' import promptAction from '@ohos.promptAction'
export default { export default {
change(e){ change(e){
prompt.showToast({ promptAction.showToast({
message: "value: " + e.value, message: "value: " + e.value,
duration: 3000, duration: 3000,
}); });
}, },
enterkeyClick(e){ enterkeyClick(e){
prompt.showToast({ promptAction.showToast({
message: "enterkey clicked", message: "enterkey clicked",
duration: 3000, duration: 3000,
}); });
...@@ -192,10 +192,10 @@ ...@@ -192,10 +192,10 @@
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt' import promptAction from '@ohos.promptAction'
export default { export default {
checkboxOnChange(e) { checkboxOnChange(e) {
prompt.showToast({ promptAction.showToast({
message:'checked: ' + e.checked, message:'checked: ' + e.checked,
duration: 3000, duration: 3000,
}); });
...@@ -227,11 +227,11 @@ ...@@ -227,11 +227,11 @@
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt' import promptAction from '@ohos.promptAction'
export default { export default {
onRadioChange(inputValue, e) { onRadioChange(inputValue, e) {
if (inputValue === e.value) { if (inputValue === e.value) {
prompt.showToast({ promptAction.showToast({
message: 'The chosen radio is ' + e.value, message: 'The chosen radio is ' + e.value,
duration: 3000, duration: 3000,
}); });
......
...@@ -90,10 +90,10 @@ ...@@ -90,10 +90,10 @@
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
onMenuSelected(e) { onMenuSelected(e) {
prompt.showToast({ promptAction.showToast({
message: e.value message: e.value
}) })
}, },
......
...@@ -223,8 +223,7 @@ select { ...@@ -223,8 +223,7 @@ select {
```js ```js
// xxx.js // xxx.js
import router from '@system.router'; import promptAction from '@ohos.promptAction';
import prompt from '@system.prompt';
export default { export default {
data: { data: {
...@@ -252,63 +251,63 @@ export default { ...@@ -252,63 +251,63 @@ export default {
}, },
textonchange(e) { textonchange(e) {
this.textvalue = e.newValue; this.textvalue = e.newValue;
prompt.showToast({ promptAction.showToast({
message: "text:" + e.newValue + ",newSelected:" + e.newSelected message: "text:" + e.newValue + ",newSelected:" + e.newSelected
}) })
}, },
textoncancel(e) { textoncancel(e) {
prompt.showToast({ promptAction.showToast({
message: "text: textoncancel" message: "text: textoncancel"
}) })
}, },
dateonchange(e) { dateonchange(e) {
this.datevalue = e.year + "-" + e.month + "-" + e.day; this.datevalue = e.year + "-" + e.month + "-" + e.day;
prompt.showToast({ promptAction.showToast({
message: "date:" + e.year + "-" + (e.month + 1) + "-" + e.day message: "date:" + e.year + "-" + (e.month + 1) + "-" + e.day
}) })
}, },
dateoncancel() { dateoncancel() {
prompt.showToast({ promptAction.showToast({
message: "date: dateoncancel" message: "date: dateoncancel"
}) })
}, },
timeonchange(e) { timeonchange(e) {
if (this.containsecond) { if (this.containsecond) {
this.timevalue = e.hour + ":" + e.minute + ":" + e.second; this.timevalue = e.hour + ":" + e.minute + ":" + e.second;
prompt.showToast({ promptAction.showToast({
message: "Time:" + e.hour + ":" + e.minute + ":" + e.second message: "Time:" + e.hour + ":" + e.minute + ":" + e.second
}) })
} else { } else {
this.timevalue = e.hour + ":" + e.minute; this.timevalue = e.hour + ":" + e.minute;
prompt.showToast({ promptAction.showToast({
message: "Time:" + e.hour + ":" + e.minute message: "Time:" + e.hour + ":" + e.minute
}) })
} }
}, },
timeoncancel() { timeoncancel() {
prompt.showToast({ promptAction.showToast({
message: "timeoncancel" message: "timeoncancel"
}) })
}, },
datetimeonchange(e) { datetimeonchange(e) {
this.datetimevalue = e.year + "-" + e.month + "-" + e.day + " " + e.hour + ":" + e.minute; this.datetimevalue = e.year + "-" + e.month + "-" + e.day + " " + e.hour + ":" + e.minute;
prompt.showToast({ promptAction.showToast({
message: "Time:" + (e.month + 1) + "-" + e.day + " " + e.hour + ":" + e.minute message: "Time:" + (e.month + 1) + "-" + e.day + " " + e.hour + ":" + e.minute
}) })
}, },
datetimeoncancel() { datetimeoncancel() {
prompt.showToast({ promptAction.showToast({
message: "datetimeoncancel" message: "datetimeoncancel"
}) })
}, },
multitextonchange(e) { multitextonchange(e) {
this.multitextvalue = e.newValue; this.multitextvalue = e.newValue;
prompt.showToast({ promptAction.showToast({
message: "Multi-column text change" + e.newValue message: "Multi-column text change" + e.newValue
}) })
}, },
multitextoncancel() { multitextoncancel() {
prompt.showToast({ promptAction.showToast({
message: "multitextoncancel" message: "multitextoncancel"
}) })
}, },
......
...@@ -83,10 +83,10 @@ rating { ...@@ -83,10 +83,10 @@ rating {
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
changeRating(e){ changeRating(e){
prompt.showToast({ promptAction.showToast({
message: e.rating message: e.rating
}); });
} }
......
...@@ -91,29 +91,29 @@ ...@@ -91,29 +91,29 @@
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data: { data: {
title: 'World' title: 'World'
}, },
switchChange(e) { switchChange(e) {
if (e.checked) { if (e.checked) {
prompt.showToast({ promptAction.showToast({
message: "打开开关" message: "打开开关"
}); });
} else { } else {
prompt.showToast({ promptAction.showToast({
message: "关闭开关" message: "关闭开关"
}); });
} }
}, },
normalswitchChange(e) { normalswitchChange(e) {
if (e.checked) { if (e.checked) {
prompt.showToast({ promptAction.showToast({
message: "switch on" message: "switch on"
}); });
} else { } else {
prompt.showToast({ promptAction.showToast({
message: "switch off" message: "switch off"
}); });
} }
......
...@@ -95,10 +95,10 @@ ...@@ -95,10 +95,10 @@
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
change(e){ change(e){
prompt.showToast({ promptAction.showToast({
message: 'value: ' + e.text + ', lines: ' + e.lines + ', height: ' + e.height, message: 'value: ' + e.text + ', lines: ' + e.lines + ', height: ' + e.height,
duration: 3000, duration: 3000,
}); });
......
...@@ -26,14 +26,14 @@ ImageData对象可以存储canvas渲染的像素数据。 ...@@ -26,14 +26,14 @@ ImageData对象可以存储canvas渲染的像素数据。
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
onShow() { onShow() {
const el =this.$refs.canvas; const el =this.$refs.canvas;
const ctx = el.getContext('2d'); const ctx = el.getContext('2d');
ctx.fillRect(0,0,200,200) ctx.fillRect(0,0,200,200)
var imageData = ctx.createImageData(1,1) var imageData = ctx.createImageData(1,1)
prompt.showToast({ promptAction.showToast({
message:imageData, message:imageData,
duration:5000 duration:5000
}) })
......
...@@ -138,7 +138,7 @@ button{ ...@@ -138,7 +138,7 @@ button{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default{ export default{
data:{ data:{
animation:'', animation:'',
...@@ -161,19 +161,19 @@ export default{ ...@@ -161,19 +161,19 @@ export default{
this.animation = this.$element('idName').animate(frames, options); this.animation = this.$element('idName').animate(frames, options);
// handle finish event // handle finish event
this.animation.onfinish = function(){ this.animation.onfinish = function(){
prompt.showToast({ promptAction.showToast({
message: "The animation is finished." message: "The animation is finished."
}); });
}; };
// handle cancel event // handle cancel event
this.animation.oncancel = function(){ this.animation.oncancel = function(){
prompt.showToast({ promptAction.showToast({
message: "The animation is canceled." message: "The animation is canceled."
}); });
}; };
// handle repeat event // handle repeat event
this.animation.onrepeat = function(){ this.animation.onrepeat = function(){
prompt.showToast({ promptAction.showToast({
message: "The animation is repeated." message: "The animation is repeated."
}); });
}; };
......
...@@ -257,7 +257,7 @@ Page1有一个不透明盒子,点击盒子会跳转到Page2,当点击Page2 ...@@ -257,7 +257,7 @@ Page1有一个不透明盒子,点击盒子会跳转到Page2,当点击Page2
</div> </div>
``` ```
```css ```js
// xxx.js // xxx.js
import router from '@ohos.router'; import router from '@ohos.router';
export default { export default {
......
...@@ -130,30 +130,30 @@ ...@@ -130,30 +130,30 @@
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
showDialog() { showDialog() {
this.$element('simpledialog').show() this.$element('simpledialog').show()
}, },
cancelDialog() { cancelDialog() {
prompt.showToast({ promptAction.showToast({
message: 'Dialog cancelled' message: 'Dialog cancelled'
}) })
}, },
cancelSchedule() { cancelSchedule() {
this.$element('simpledialog').close() this.$element('simpledialog').close()
prompt.showToast({ promptAction.showToast({
message: 'Successfully cancelled' message: 'Successfully cancelled'
}) })
}, },
setSchedule() { setSchedule() {
this.$element('simpledialog').close() this.$element('simpledialog').close()
prompt.showToast({ promptAction.showToast({
message: 'Successfully confirmed' message: 'Successfully confirmed'
}) })
}, },
doubleclick(){ doubleclick(){
prompt.showToast({ promptAction.showToast({
message: 'doubleclick' message: 'doubleclick'
}) })
} }
......
...@@ -252,22 +252,22 @@ ...@@ -252,22 +252,22 @@
``` ```
```css ```css
/* xxx.css */ /* xxx.css */
.container { .container {
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.content { .content {
width: 200px; width: 200px;
height: 200px; height: 200px;
background-color: red; background-color: red;
} }
``` ```
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data:{ data:{
left:0, left:0,
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
this.top = e.globalY; this.top = e.globalY;
}, },
dragend(e){ dragend(e){
prompt.showToast({ promptAction.showToast({
message: 'End Drag' message: 'End Drag'
}) })
} }
...@@ -320,7 +320,7 @@ ...@@ -320,7 +320,7 @@
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data:{ data:{
left:0, left:0,
...@@ -331,22 +331,22 @@ ...@@ -331,22 +331,22 @@
this.top = e.globalY; this.top = e.globalY;
}, },
dragenter(e){ dragenter(e){
prompt.showToast({ promptAction.showToast({
message: 'enter' message: 'enter'
}) })
}, },
dragover(e){ dragover(e){
prompt.showToast({ promptAction.showToast({
message: 'over' message: 'over'
}) })
}, },
dragleave(e){ dragleave(e){
prompt.showToast({ promptAction.showToast({
message: 'leave' message: 'leave'
}) })
}, },
drop(e){ drop(e){
prompt.showToast({ promptAction.showToast({
message: 'drop' message: 'drop'
}) })
} }
......
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data: { data: {
direction: 'column', direction: 'column',
...@@ -157,12 +157,12 @@ export default { ...@@ -157,12 +157,12 @@ export default {
this.$element('mylist').expandGroup() this.$element('mylist').expandGroup()
}, },
collapse(e) { collapse(e) {
prompt.showToast({ promptAction.showToast({
message: 'Close ' + e.groupid message: 'Close ' + e.groupid
}) })
}, },
expand(e) { expand(e) {
prompt.showToast({ promptAction.showToast({
message: 'Open ' + e.groupid message: 'Open ' + e.groupid
}) })
} }
......
...@@ -110,10 +110,10 @@ ...@@ -110,10 +110,10 @@
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt' import promptAction from '@ohos.promptAction'
export default { export default {
visibilitychange(e) { visibilitychange(e) {
prompt.showToast({ promptAction.showToast({
message: 'visibility change visibility: ' + e.visibility, message: 'visibility change visibility: ' + e.visibility,
duration: 3000 duration: 3000
}); });
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data: { data: {
list:[], list:[],
...@@ -120,7 +120,7 @@ export default { ...@@ -120,7 +120,7 @@ export default {
} }
}, },
refresh: function (e) { refresh: function (e) {
prompt.showToast({ promptAction.showToast({
message: '刷新中...' message: '刷新中...'
}) })
var that = this; var that = this;
...@@ -129,7 +129,7 @@ export default { ...@@ -129,7 +129,7 @@ export default {
that.fresh = false; that.fresh = false;
var addItem = '更新元素'; var addItem = '更新元素';
that.list.unshift(addItem); that.list.unshift(addItem);
prompt.showToast({ promptAction.showToast({
message: '刷新完成!' message: '刷新完成!'
}) })
}, 2000) }, 2000)
......
...@@ -92,11 +92,11 @@ grid-col是栅格布局容器grid-row的子容器组件。 ...@@ -92,11 +92,11 @@ grid-col是栅格布局容器grid-row的子容器组件。
```js ```js
// index.js // index.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
getCol(e) { getCol(e) {
this.$element('mygrid').getColumns(function (result) { this.$element('mygrid').getColumns(function (result) {
prompt.showToast({ promptAction.showToast({
message: e.target.id + ' result = ' + result, message: e.target.id + ' result = ' + result,
duration: 3000, duration: 3000,
}); });
...@@ -104,7 +104,7 @@ export default { ...@@ -104,7 +104,7 @@ export default {
}, },
getColWidth(e) { getColWidth(e) {
this.$element('mygrid').getColumnWidth(function (result) { this.$element('mygrid').getColumnWidth(function (result) {
prompt.showToast({ promptAction.showToast({
message: e.target.id + ' result = ' + result, message: e.target.id + ' result = ' + result,
duration: 3000, duration: 3000,
}); });
......
...@@ -354,6 +354,7 @@ struct ImageExample3 { ...@@ -354,6 +354,7 @@ struct ImageExample3 {
```ts ```ts
import fileio from '@ohos.fileio' import fileio from '@ohos.fileio'
import fs from '@ohos.file.fs';
import context from '@ohos.application.context' import context from '@ohos.application.context'
@Entry @Entry
...@@ -374,7 +375,7 @@ struct LoadImageExample { ...@@ -374,7 +375,7 @@ struct LoadImageExample {
.onClick(() => { .onClick(() => {
this.sandboxPath = this.context.getApplicationContext().filesDir + '/icon.png' this.sandboxPath = this.context.getApplicationContext().filesDir + '/icon.png'
console.log(`读取沙箱图片=========>${this.sandboxPath}`) console.log(`读取沙箱图片=========>${this.sandboxPath}`)
let fd = fileio.openSync(this.sandboxPath, 0o100, 0o666) let fd = fs.openSync(this.sandboxPath, 0o100)
console.log(`create file========>${fd}`) console.log(`create file========>${fd}`)
let srcPath = this.context.bundleCodeDir + '/entry/resources/base/media/icon.png' let srcPath = this.context.bundleCodeDir + '/entry/resources/base/media/icon.png'
console.log('mySrcpath' + srcPath) console.log('mySrcpath' + srcPath)
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
```ts ```ts
// xxx.ets // xxx.ets
import prompt from '@ohos.prompt' import promptAction from '@ohos.promptAction'
@Entry @Entry
@Component @Component
...@@ -38,14 +38,14 @@ struct AppearExample { ...@@ -38,14 +38,14 @@ struct AppearExample {
Text(this.myText).fontSize(26).fontWeight(FontWeight.Bold) Text(this.myText).fontSize(26).fontWeight(FontWeight.Bold)
.onAppear(() => { .onAppear(() => {
this.changeAppear = 'Hide Text' this.changeAppear = 'Hide Text'
prompt.showToast({ promptAction.showToast({
message: 'The text is shown', message: 'The text is shown',
duration: 2000 duration: 2000
}) })
}) })
.onDisAppear(() => { .onDisAppear(() => {
this.changeAppear = 'Show Text' this.changeAppear = 'Show Text'
prompt.showToast({ promptAction.showToast({
message: 'The text is hidden', message: 'The text is hidden',
duration: 2000 duration: 2000
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册