提交 38178373 编写于 作者: Y yamila

update cherryPickMonthly

Signed-off-by: Nyamila <tianyu55@huawei.com>
上级 aa7d8b16
...@@ -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,7 +91,7 @@ ...@@ -91,7 +91,7 @@
```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'
...@@ -109,11 +109,11 @@ export default { ...@@ -109,11 +109,11 @@ export default {
}, },
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,29 +252,29 @@ ...@@ -252,29 +252,29 @@
``` ```
```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,
top:0, top:0,
}, },
dragstart(e){ dragstart(e){
prompt.showToast({ promptAction.showToast({
message: 'Start to be dragged' message: 'Start to be dragged'
}) })
}, },
...@@ -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'
}) })
} }
...@@ -384,25 +384,25 @@ ...@@ -384,25 +384,25 @@
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
pinchstart(e){ pinchstart(e){
prompt.showToast({ promptAction.showToast({
message: 'pinchstart!!!' message: 'pinchstart!!!'
}) })
}, },
pinchupdate(e){ pinchupdate(e){
prompt.showToast({ promptAction.showToast({
message: 'Two-finger pinch update' message: 'Two-finger pinch update'
}) })
}, },
pinchend(e){ pinchend(e){
prompt.showToast({ promptAction.showToast({
message: 'Finished with two fingers pinching' message: 'Finished with two fingers pinching'
}) })
}, },
pinchcancel(e){ pinchcancel(e){
prompt.showToast({ promptAction.showToast({
message: 'Finger pinching is interrupted' message: 'Finger pinching is interrupted'
}) })
} }
......
...@@ -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
}) })
......
...@@ -45,10 +45,10 @@ ...@@ -45,10 +45,10 @@
**res-defaults.json示例:**<br/> **res-defaults.json示例:**<br/>
``` ```json
{ {
strings: { "strings": {
hello: 'hello world' "hello": "hello world"
} }
} }
``` ```
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
resources/res-dark.json: resources/res-dark.json:
``` ```json
{ {
"image": { "image": {
"clockFace": "common/dark_face.png" "clockFace": "common/dark_face.png"
...@@ -70,7 +70,7 @@ resources/res-dark.json: ...@@ -70,7 +70,7 @@ resources/res-dark.json:
resources/res-defaults.json: resources/res-defaults.json:
``` ```json
{ {
"image": { "image": {
"clockFace": "common/face.png" "clockFace": "common/face.png"
...@@ -81,7 +81,7 @@ resources/res-defaults.json: ...@@ -81,7 +81,7 @@ resources/res-defaults.json:
} }
``` ```
``` ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div style="background-color: {{ $r('colors.background') }}"> <div style="background-color: {{ $r('colors.background') }}">
<image src="{{ $r('image.clockFace') }}"></image> <image src="{{ $r('image.clockFace') }}"></image>
......
...@@ -11,7 +11,7 @@ JS文件用来定义HML页面的业务逻辑,支持ECMA规范的JavaScript语 ...@@ -11,7 +11,7 @@ JS文件用来定义HML页面的业务逻辑,支持ECMA规范的JavaScript语
使用import方法引入功能模块: 使用import方法引入功能模块:
```js ```js
import router from '@system.router'; import router from '@ohos.router';
``` ```
- 代码引用 - 代码引用
......
...@@ -388,7 +388,7 @@ button{ ...@@ -388,7 +388,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: '',
...@@ -427,17 +427,17 @@ export default { ...@@ -427,17 +427,17 @@ export default {
]; ];
this.animation = this.$element('content').animate(frames, options); this.animation = this.$element('content').animate(frames, options);
this.animation.onstart = function(){ this.animation.onstart = function(){
prompt.showToast({ promptAction.showToast({
message: "start" message: "start"
}); });
}; };
this.animation.onrepeat = function(){ this.animation.onrepeat = function(){
prompt.showToast({ promptAction.showToast({
message: " repeated" message: " repeated"
}); });
}; };
this.animation.onfinish = function(){ this.animation.onfinish = function(){
prompt.showToast({ promptAction.showToast({
message: " finished" message: " finished"
}); });
}; };
......
...@@ -48,7 +48,6 @@ index和detail这两个页面均包含一个text组件和button组件:text组 ...@@ -48,7 +48,6 @@ index和detail这两个页面均包含一个text组件和button组件:text组
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.title { .title {
font-size: 50px; font-size: 50px;
margin-bottom: 50px; margin-bottom: 50px;
......
...@@ -181,10 +181,10 @@ tabs默认展示索引为index的标签及内容。通过设置vertical属性使 ...@@ -181,10 +181,10 @@ tabs默认展示索引为index的标签及内容。通过设置vertical属性使
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
tabChange(e){ tabChange(e){
prompt.showToast({ promptAction.showToast({
message: "Tab index: " + e.index message: "Tab index: " + e.index
}) })
} }
...@@ -271,7 +271,6 @@ background-color:#F1F3F5; ...@@ -271,7 +271,6 @@ background-color:#F1F3F5;
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
export default { export default {
data() { data() {
return { return {
......
...@@ -81,7 +81,7 @@ button是按钮组件,其类型包括胶囊按钮、圆形按钮、文本按 ...@@ -81,7 +81,7 @@ button是按钮组件,其类型包括胶囊按钮、圆形按钮、文本按
如果需要添加ohos.permission.INTERNET权限,则在resources文件夹下的config.json文件里进行权限配置。 如果需要添加ohos.permission.INTERNET权限,则在resources文件夹下的config.json文件里进行权限配置。
``` ```json
<!-- config.json --> <!-- config.json -->
"module": { "module": {
"reqPermissions": [{ "reqPermissions": [{
...@@ -121,7 +121,7 @@ button是按钮组件,其类型包括胶囊按钮、圆形按钮、文本按 ...@@ -121,7 +121,7 @@ button是按钮组件,其类型包括胶囊按钮、圆形按钮、文本按
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data: { data: {
percent: 0, percent: 0,
...@@ -135,7 +135,7 @@ export default { ...@@ -135,7 +135,7 @@ export default {
this.percent += 1; this.percent += 1;
this.downloadText = this.percent+ "%"; this.downloadText = this.percent+ "%";
} else{ } else{
prompt.showToast({ promptAction.showToast({
message: "Download succeeded." message: "Download succeeded."
}) })
this.paused() this.paused()
...@@ -151,13 +151,13 @@ export default { ...@@ -151,13 +151,13 @@ export default {
}, },
setProgress(e) { setProgress(e) {
if(this.isPaused){ if(this.isPaused){
prompt.showToast({ promptAction.showToast({
message: "Started Downloading" message: "Started Downloading"
}) })
this.start(); this.start();
this.isPaused = false; this.isPaused = false;
}else{ }else{
prompt.showToast({ promptAction.showToast({
message: "Paused." message: "Paused."
}) })
this.paused(); this.paused();
......
...@@ -9,7 +9,7 @@ Canvas组件提供画布,用于自定义绘制图形。具体用法请参考[C ...@@ -9,7 +9,7 @@ Canvas组件提供画布,用于自定义绘制图形。具体用法请参考[C
在pages/index目录下的hml文件中创建一个Canvas组件。 在pages/index目录下的hml文件中创建一个Canvas组件。
``` ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div class="container"> <div class="container">
<canvas></canvas> <canvas></canvas>
...@@ -116,7 +116,7 @@ Canvas添加长按事件,长按后可获取Canvas组件的dataUrl值(toDataU ...@@ -116,7 +116,7 @@ Canvas添加长按事件,长按后可获取Canvas组件的dataUrl值(toDataU
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data:{ data:{
dataURL:null, dataURL:null,
...@@ -130,7 +130,7 @@ export default { ...@@ -130,7 +130,7 @@ export default {
let el = this.$refs.canvas1 let el = this.$refs.canvas1
let dataUrl = el.toDataURL() let dataUrl = el.toDataURL()
this.dataURL = dataUrl; this.dataURL = dataUrl;
prompt.showToast({duration:2000,message:"long press,get dataURL"}) promptAction.showToast({duration:2000,message:"long press,get dataURL"})
} }
} }
``` ```
......
...@@ -51,7 +51,6 @@ select{ ...@@ -51,7 +51,6 @@ select{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
export default { export default {
data:{ data:{
el: null, el: null,
...@@ -254,7 +253,6 @@ select{ ...@@ -254,7 +253,6 @@ select{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
export default { export default {
data:{ data:{
el: null, el: null,
...@@ -352,7 +350,6 @@ select{ ...@@ -352,7 +350,6 @@ select{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
export default { export default {
data:{ data:{
el: null, el: null,
...@@ -478,7 +475,6 @@ select{ ...@@ -478,7 +475,6 @@ select{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
export default { export default {
data:{ data:{
el: null, el: null,
...@@ -635,7 +631,7 @@ text{ ...@@ -635,7 +631,7 @@ text{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data:{ data:{
compositeOperation: 'source-over' compositeOperation: 'source-over'
...@@ -678,7 +674,7 @@ export default { ...@@ -678,7 +674,7 @@ export default {
}; };
// 图片获取失败触发方法 // 图片获取失败触发方法
img1.onerror = function() { img1.onerror = function() {
prompt.showToast({message:"error",duration:2000}) promptAction.showToast({message:"error",duration:2000})
}; };
}, },
rotate(){ rotate(){
...@@ -805,7 +801,7 @@ text{ ...@@ -805,7 +801,7 @@ text{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data:{ data:{
ctx: '', ctx: '',
...@@ -818,7 +814,7 @@ export default { ...@@ -818,7 +814,7 @@ export default {
save(){ save(){
// 画笔储存 // 画笔储存
this.ctx.save(); this.ctx.save();
prompt.showToast({message:"save succeed"}); promptAction.showToast({message:"save succeed"});
}, },
clear(){ clear(){
this.ctx.clearRect(0,0,600,500); this.ctx.clearRect(0,0,600,500);
......
...@@ -119,22 +119,22 @@ button{ ...@@ -119,22 +119,22 @@ button{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
canceldialog(e){ canceldialog(e){
prompt.showToast({ promptAction.showToast({
message: 'dialogCancel' message: 'dialogCancel'
}) })
}, },
opendialog(){ opendialog(){
this.$element('dialogId').show() this.$element('dialogId').show()
prompt.showToast({ promptAction.showToast({
message: 'dialogShow' message: 'dialogShow'
}) })
}, },
confirmClick(e) { confirmClick(e) {
this.$element('dialogId').close() this.$element('dialogId').close()
prompt.showToast({ promptAction.showToast({
message: 'dialogClose' message: 'dialogClose'
}) })
}, },
...@@ -266,8 +266,8 @@ export default { ...@@ -266,8 +266,8 @@ export default {
```js ```js
// xxx.js // xxx.js
var info = null; var info = null;
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
import router from '@system.router';
export default { export default {
data: { data: {
curYear:'', curYear:'',
...@@ -290,7 +290,7 @@ export default { ...@@ -290,7 +290,7 @@ export default {
this.$element('datedialog').show() this.$element('datedialog').show()
}, },
canceldialog(e) { canceldialog(e) {
prompt.showToast({ promptAction.showToast({
message: 'Event setting canceled.' message: 'Event setting canceled.'
}) })
}, },
...@@ -299,7 +299,7 @@ export default { ...@@ -299,7 +299,7 @@ export default {
}, },
cancelschedule(e) { cancelschedule(e) {
this.$element('datedialog').close() this.$element('datedialog').close()
prompt.showToast({ promptAction.showToast({
message: 'Event setting canceled.' message: 'Event setting canceled.'
}) })
}, },
......
...@@ -120,15 +120,15 @@ form是一个表单容器,支持容器内[Input](../reference/arkui-js/js-comp ...@@ -120,15 +120,15 @@ form是一个表单容器,支持容器内[Input](../reference/arkui-js/js-comp
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default{ export default{
onSubmit(result) { onSubmit(result) {
prompt.showToast({ promptAction.showToast({
message: result.value.radioGroup message: result.value.radioGroup
}) })
}, },
onReset() { onReset() {
prompt.showToast({ promptAction.showToast({
message: 'Reset All' message: 'Reset All'
}) })
} }
...@@ -201,15 +201,15 @@ label{ ...@@ -201,15 +201,15 @@ label{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
formSubmit() { formSubmit() {
prompt.showToast({ promptAction.showToast({
message: 'Submitted.' message: 'Submitted.'
}) })
}, },
formReset() { formReset() {
prompt.showToast({ promptAction.showToast({
message: 'Reset.' message: 'Reset.'
}) })
} }
......
...@@ -77,7 +77,7 @@ grid-container点击组件调用getColumns、getColumnWidth、getGutterWidth方 ...@@ -77,7 +77,7 @@ grid-container点击组件调用getColumns、getColumnWidth、getGutterWidth方
```js ```js
// index.js // index.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data:{ data:{
gutterWidth:'', gutterWidth:'',
...@@ -95,13 +95,13 @@ export default { ...@@ -95,13 +95,13 @@ export default {
this.columns= result; this.columns= result;
}) })
setTimeout(()=>{ setTimeout(()=>{
prompt.showToast({duration:5000,message:'columnWidth:'+this.columnWidth+',gutterWidth:'+ promptAction.showToast({duration:5000,message:'columnWidth:'+this.columnWidth+',gutterWidth:'+
this.gutterWidth+',getColumns:'+this.columns}) this.gutterWidth+',getColumns:'+this.columns})
}) })
}, },
getSizeType(){ getSizeType(){
this.$element('mygrid').getSizeType((result)=>{ this.$element('mygrid').getSizeType((result)=>{
prompt.showToast({duration:2000,message:'get size type:'+result}) promptAction.showToast({duration:2000,message:'get size type:'+result})
}) })
}, },
} }
...@@ -217,7 +217,7 @@ text{ ...@@ -217,7 +217,7 @@ text{
```js ```js
// index.js // index.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data:{ data:{
list:[ list:[
...@@ -228,7 +228,7 @@ export default { ...@@ -228,7 +228,7 @@ export default {
fresh:false fresh:false
}, },
refresh(e) { refresh(e) {
prompt.showToast({ promptAction.showToast({
message: 'refreshing' message: 'refreshing'
}) })
var that = this; var that = this;
...@@ -236,7 +236,7 @@ export default { ...@@ -236,7 +236,7 @@ export default {
setTimeout(function () { setTimeout(function () {
that.fresh = false; that.fresh = false;
that.list.unshift({src: 'common/images/4.png',id:'4'}); that.list.unshift({src: 'common/images/4.png',id:'4'});
prompt.showToast({ promptAction.showToast({
message: 'succeed' message: 'succeed'
}) })
}, 2000) }, 2000)
......
...@@ -177,7 +177,7 @@ export default { ...@@ -177,7 +177,7 @@ export default {
```js ```js
// index.js // index.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data: { data: {
imginfo: [ imginfo: [
...@@ -201,22 +201,22 @@ export default { ...@@ -201,22 +201,22 @@ export default {
this.$element('img').resume() this.$element('img').resume()
}, },
popstart(e) { popstart(e) {
prompt.showToast({ promptAction.showToast({
message: '开始' message: '开始'
}) })
}, },
poppause(e) { poppause(e) {
prompt.showToast({ promptAction.showToast({
message: '暂停' message: '暂停'
}) })
}, },
popstop(e) { popstop(e) {
prompt.showToast({ promptAction.showToast({
message: '停止' message: '停止'
}) })
}, },
popresume(e) { popresume(e) {
prompt.showToast({ promptAction.showToast({
message: '恢复' message: '恢复'
}) })
} }
...@@ -285,7 +285,7 @@ button{ ...@@ -285,7 +285,7 @@ button{
```js ```js
// index.js // index.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data: { data: {
rev:false, rev:false,
...@@ -317,7 +317,7 @@ export default { ...@@ -317,7 +317,7 @@ export default {
this.$element('img').resume() this.$element('img').resume()
}, },
getimgstate(e) { getimgstate(e) {
prompt.showToast({ promptAction.showToast({
message: '当前状态:' + this.$element('img').getState() message: '当前状态:' + this.$element('img').getState()
}) })
}, },
......
...@@ -101,17 +101,17 @@ image{ ...@@ -101,17 +101,17 @@ image{
```js ```js
// index.js // index.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
imageComplete(i,e){ imageComplete(i,e){
prompt.showToast({ promptAction.showToast({
message: "image "+i+"'s width"+ e.width+"----image "+i+"'s height"+e.height, message: "image "+i+"'s width"+ e.width+"----image "+i+"'s height"+e.height,
duration: 3000, duration: 3000,
}) })
}, },
imageError(i,e){ imageError(i,e){
setTimeout(()=>{ setTimeout(()=>{
prompt.showToast({ promptAction.showToast({
message: "Failed to load image "+i+".", message: "Failed to load image "+i+".",
duration: 3000, duration: 3000,
}) })
...@@ -177,7 +177,7 @@ export default { ...@@ -177,7 +177,7 @@ export default {
```js ```js
// index.js // index.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data: { data: {
testuri: 'common/images/bg-tv.jpg', testuri: 'common/images/bg-tv.jpg',
...@@ -185,7 +185,7 @@ export default { ...@@ -185,7 +185,7 @@ export default {
timer: null timer: null
}, },
changeopacity: function () { changeopacity: function () {
prompt.showToast({ promptAction.showToast({
message: 'Touch and hold the image.' message: 'Touch and hold the image.'
}) })
var opval = this.imageopacity * 20 var opval = this.imageopacity * 20
......
...@@ -145,16 +145,16 @@ text{ ...@@ -145,16 +145,16 @@ text{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt' import promptAction from '@ohos.promptAction'
export default { export default {
search(e){ search(e){
prompt.showToast({ promptAction.showToast({
message: e.value, message: e.value,
duration: 3000, duration: 3000,
}); });
}, },
translate(e){ translate(e){
prompt.showToast({ promptAction.showToast({
message: e.value, message: e.value,
duration: 3000, duration: 3000,
}); });
...@@ -200,14 +200,14 @@ export default { ...@@ -200,14 +200,14 @@ export default {
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt' import promptAction from '@ohos.promptAction'
export default { export default {
data:{ data:{
value:'', value:'',
}, },
change(e){ change(e){
this.value = e.value; this.value = e.value;
prompt.showToast({ promptAction.showToast({
message: "value: " + this.value, message: "value: " + this.value,
duration: 3000, duration: 3000,
}); });
...@@ -222,7 +222,7 @@ import prompt from '@system.prompt' ...@@ -222,7 +222,7 @@ import prompt from '@system.prompt'
error:this.value + 'This field cannot be left empty.' error:this.value + 'This field cannot be left empty.'
}); });
}else{ }else{
prompt.showToast({ promptAction.showToast({
message: "success " message: "success "
}); });
} }
...@@ -302,14 +302,14 @@ label { ...@@ -302,14 +302,14 @@ label {
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data: { data: {
}, },
onInit() { onInit() {
}, },
btnclick(e) { btnclick(e) {
prompt.showToast({ promptAction.showToast({
message:'Saved successfully!' message:'Saved successfully!'
}) })
} }
......
...@@ -162,7 +162,7 @@ margin-top:30px; ...@@ -162,7 +162,7 @@ margin-top:30px;
```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',
...@@ -179,12 +179,12 @@ export default { ...@@ -179,12 +179,12 @@ export default {
} }
}, },
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
}) })
} }
......
...@@ -150,15 +150,15 @@ option{ ...@@ -150,15 +150,15 @@ option{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
select(e) { select(e) {
prompt.showToast({ promptAction.showToast({
message: e.value message: e.value
}) })
}, },
cancel(){ cancel(){
prompt.showToast({ promptAction.showToast({
message: "cancel" message: "cancel"
}) })
}, },
...@@ -242,7 +242,6 @@ option{ ...@@ -242,7 +242,6 @@ option{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
export default { export default {
data:{ data:{
fresh: false, fresh: false,
......
...@@ -49,7 +49,7 @@ select{ ...@@ -49,7 +49,7 @@ select{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data:{ data:{
el: null, el: null,
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
_this.offCanvas.drawImage(_this.img, 100, 100, 400, 300); _this.offCanvas.drawImage(_this.img, 100, 100, 400, 300);
}; };
this.img.onerror = function() { this.img.onerror = function() {
prompt.showToast({message:"error",duration:2000}) promptAction.showToast({message:"error",duration:2000})
}; };
var bitmap = this.offscreen.transferToImageBitmap(); this.ctx.transferFromImageBitmap(bitmap); var bitmap = this.offscreen.transferToImageBitmap(); this.ctx.transferFromImageBitmap(bitmap);
}, },
......
...@@ -36,8 +36,6 @@ canvas { ...@@ -36,8 +36,6 @@ canvas {
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
export default { export default {
onShow() { onShow() {
let ctx = this.$refs.canvas.getContext('2d', { let ctx = this.$refs.canvas.getContext('2d', {
...@@ -139,8 +137,6 @@ text { ...@@ -139,8 +137,6 @@ text {
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
export default { export default {
data: { data: {
ctx: null, ctx: null,
......
...@@ -144,7 +144,7 @@ picker的hours属性定义时间的展现格式,可选类型有12小时制和2 ...@@ -144,7 +144,7 @@ picker的hours属性定义时间的展现格式,可选类型有12小时制和2
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data: { data: {
multitext:[["a", "b", "c"], ["e", "f", "g"], ["h", "i"]], multitext:[["a", "b", "c"], ["e", "f", "g"], ["h", "i"]],
...@@ -153,10 +153,10 @@ export default { ...@@ -153,10 +153,10 @@ export default {
}, },
multitextonchange(e) { multitextonchange(e) {
this.multitextvalue=e.newValue; this.multitextvalue=e.newValue;
prompt.showToast({ message:"Multi-column text changed to:" + e.newValue }) promptAction.showToast({ message:"Multi-column text changed to:" + e.newValue })
}, },
multitextoncancel() { multitextoncancel() {
prompt.showToast({ message:"multitextoncancel" }) promptAction.showToast({ message:"multitextoncancel" })
}, },
} }
``` ```
...@@ -246,7 +246,7 @@ export default { ...@@ -246,7 +246,7 @@ export default {
```js ```js
// xxx.js // xxx.js
import pmt from '@system.prompt' import promptAction from '@ohos.promptAction'
export default { export default {
data: { data: {
yorn1:'No', yorn1:'No',
...@@ -281,10 +281,10 @@ export default { ...@@ -281,10 +281,10 @@ export default {
dateonchange(e) { dateonchange(e) {
e.month=e.month+1; e.month=e.month+1;
this.datevalue = e.year + "-" + e.month + "-" + e.day; this.datevalue = e.year + "-" + e.month + "-" + e.day;
pmt.showToast({ message:"date:"+e.year+"-"+e.month+"-"+e.day }) promptAction.showToast({ message:"date:"+e.year+"-"+e.month+"-"+e.day })
}, },
showtoast() { showtoast() {
pmt.showToast({ promptAction.showToast({
message: 'Submitted.', message: 'Submitted.',
duration: 2000, duration: 2000,
gravity: 'center' gravity: 'center'
......
...@@ -154,10 +154,10 @@ rating { ...@@ -154,10 +154,10 @@ rating {
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
showrating(e) { showrating(e) {
prompt.showToast({ promptAction.showToast({
message: '当前评分' + e.rating message: '当前评分' + e.rating
}) })
} }
...@@ -213,7 +213,7 @@ switch{ ...@@ -213,7 +213,7 @@ switch{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data: { data: {
backstar: '', backstar: '',
...@@ -249,7 +249,7 @@ export default { ...@@ -249,7 +249,7 @@ export default {
this.rate = e.progress this.rate = e.progress
}, },
showrating(e) { showrating(e) {
prompt.showToast({ promptAction.showToast({
message: '当前评分' + e.rating message: '当前评分' + e.rating
}) })
} }
......
...@@ -132,34 +132,34 @@ text{ ...@@ -132,34 +132,34 @@ text{
```js ```js
// index.js // index.js
import prompt from '@system.prompt' import promptAction from '@ohos.promptAction'
export default { export default {
search(e){ search(e){
prompt.showToast({ promptAction.showToast({
message: e.value, message: e.value,
duration: 3000, duration: 3000,
}); });
}, },
translate(e){ translate(e){
prompt.showToast({ promptAction.showToast({
message: e.value, message: e.value,
duration: 3000, duration: 3000,
}); });
}, },
share(e){ share(e){
prompt.showToast({ promptAction.showToast({
message: e.value, message: e.value,
duration: 3000, duration: 3000,
}); });
}, },
change(e){ change(e){
prompt.showToast({ promptAction.showToast({
message: e.value, message: e.value,
duration: 3000, duration: 3000,
}); });
}, },
submit(e){ submit(e){
prompt.showToast({ promptAction.showToast({
message: 'submit', message: 'submit',
duration: 3000, duration: 3000,
}); });
...@@ -218,7 +218,7 @@ export default { ...@@ -218,7 +218,7 @@ export default {
```js ```js
// index.js // index.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data: { data: {
showsearch: true, showsearch: true,
...@@ -243,13 +243,13 @@ export default { ...@@ -243,13 +243,13 @@ export default {
} }
}, },
submit(e) { submit(e) {
prompt.showToast({ promptAction.showToast({
message: '搜索!', message: '搜索!',
duration: 2000 duration: 2000
}) })
}, },
change(e) { change(e) {
prompt.showToast({ promptAction.showToast({
message: '内容:' + e.text, message: '内容:' + e.text,
duration: 2000 duration: 2000
}) })
......
...@@ -248,7 +248,7 @@ button{ ...@@ -248,7 +248,7 @@ button{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data: { data: {
index:0, index:0,
...@@ -261,20 +261,20 @@ export default { ...@@ -261,20 +261,20 @@ export default {
this.$element('stepperId').setNextButtonStatus({status: 'skip', label: 'SKIP'}); this.$element('stepperId').setNextButtonStatus({status: 'skip', label: 'SKIP'});
}, },
stepperFinish(){ stepperFinish(){
prompt.showToast({ promptAction.showToast({
message: 'All Finished' message: 'All Finished'
}) })
}, },
stepperChange(e){ stepperChange(e){
console.log("stepperChange"+e.index) console.log("stepperChange"+e.index)
prompt.showToast({ promptAction.showToast({
// index表示当前步骤的序号 // index表示当前步骤的序号
message: 'Previous step: '+e.prevIndex+"-------Current step:"+e.index message: 'Previous step: '+e.prevIndex+"-------Current step:"+e.index
}) })
}, },
stepperNext(e){ stepperNext(e){
console.log("stepperNext"+e.index) console.log("stepperNext"+e.index)
prompt.showToast({ promptAction.showToast({
// pendingIndex表示将要跳转的序号 // pendingIndex表示将要跳转的序号
message: 'Current step:'+e.index+"-------Next step:"+e.pendingIndex message: 'Current step:'+e.index+"-------Next step:"+e.pendingIndex
}) })
...@@ -363,8 +363,6 @@ export default { ...@@ -363,8 +363,6 @@ export default {
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
import router from '@system.router';
let myset = new Set(); let myset = new Set();
export default { export default {
data: { data: {
......
...@@ -261,13 +261,13 @@ select{ ...@@ -261,13 +261,13 @@ select{
```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({duration:2000,message:"current index:"+e.index}); promptAction.showToast({duration:2000,message:"current index:"+e.index});
}, },
finish(){ finish(){
prompt.showToast({duration:2000,message:"切换动作结束"}); promptAction.showToast({duration:2000,message:"切换动作结束"});
}, },
selectChange(e){ selectChange(e){
this.$element('swiper').swipeTo({index: Number(e.newValue)}); this.$element('swiper').swipeTo({index: Number(e.newValue)});
...@@ -343,7 +343,6 @@ swiper{ ...@@ -343,7 +343,6 @@ swiper{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
export default { export default {
data:{ data:{
index: 0, index: 0,
......
...@@ -61,15 +61,15 @@ switch { ...@@ -61,15 +61,15 @@ switch {
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
switchChange(e){ switchChange(e){
if(e.checked){ if(e.checked){
prompt.showToast({ promptAction.showToast({
message: "open" message: "open"
}); });
}else{ }else{
prompt.showToast({ promptAction.showToast({
message: "close" message: "close"
}); });
} }
...@@ -167,7 +167,6 @@ switch{ ...@@ -167,7 +167,6 @@ switch{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
export default { export default {
data:{ data:{
address: '', address: '',
......
...@@ -153,17 +153,17 @@ toolbar-item{ ...@@ -153,17 +153,17 @@ toolbar-item{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data:{ data:{
itemColor:'black' itemColor:'black'
}, },
itemClick(){ itemClick(){
this.itemColor= "red"; this.itemColor= "red";
prompt.showToast({duration:2000,message:'item click'}); promptAction.showToast({duration:2000,message:'item click'});
}, },
itemLongPress(){ itemLongPress(){
prompt.showToast({duration:2000,message:'item long press'}); promptAction.showToast({duration:2000,message:'item long press'});
this.itemColor= "blue"; this.itemColor= "blue";
}, },
} }
...@@ -210,7 +210,6 @@ toolbar-item{ ...@@ -210,7 +210,6 @@ toolbar-item{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
export default { export default {
data:{ data:{
active: 0, active: 0,
......
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
delay: 100, delay: 100,
onFinish: () => { onFinish: () => {
setTimeout(() => { setTimeout(() => {
router.replace({ url: "pages/FoodCategoryList" }) router.replaceUrl({ url: "pages/FoodCategoryList" })
}, 1000); }, 1000);
} }
}, () => { }, () => {
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
delay: 100, delay: 100,
onFinish: () => { onFinish: () => {
setTimeout(() => { setTimeout(() => {
router.replace({ url: "pages/FoodCategoryList" }) router.replaceUrl({ url: "pages/FoodCategoryList" })
}, 1000); }, 1000);
} }
}, () => { }, () => {
...@@ -305,7 +305,7 @@ ...@@ -305,7 +305,7 @@
.height(184) .height(184)
.width('100%') .width('100%')
.onClick(() => { .onClick(() => {
router.push({ url: 'pages/FoodDetail', params: { foodData: this.foodItem } }) router.pushUrl({ url: 'pages/FoodDetail', params: { foodData: this.foodItem } })
}) })
} }
} }
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
.height(184) .height(184)
.width('100%') .width('100%')
.onClick(() => { .onClick(() => {
router.push({ url: 'pages/FoodDetail' }) router.pushUrl({ url: 'pages/FoodDetail' })
}) })
} }
} }
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
FoodGridItem调用的routerAPI同样有携带参数跳转的能力,使用方法和Navigator类似。 FoodGridItem调用的routerAPI同样有携带参数跳转的能力,使用方法和Navigator类似。
```ts ```ts
router.push({ router.pushUrl({
url: 'pages/FoodDetail', url: 'pages/FoodDetail',
params: { foodData: this.foodItem } params: { foodData: this.foodItem }
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册