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

!12286 新接口替代router和prompt错误码废弃接口

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