未验证 提交 0056ae8b 编写于 作者: O openharmony_ci 提交者: Gitee

!13274 翻译完成 11477+12200

Merge pull request !13274 from ester.zhou/TR-11477
...@@ -45,10 +45,10 @@ You can use the $r syntax in the application development files .hml and .js to f ...@@ -45,10 +45,10 @@ You can use the $r syntax in the application development files .hml and .js to f
Example of res-defaults.json:<br/> Example of res-defaults.json:<br/>
``` ```json
{ {
strings: { "strings": {
hello: 'hello world' "hello": "hello world"
} }
} }
``` ```
...@@ -57,7 +57,7 @@ Example of res-defaults.json:<br/> ...@@ -57,7 +57,7 @@ Example of res-defaults.json:<br/>
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>
......
...@@ -13,7 +13,7 @@ The ES6 syntax is supported. ...@@ -13,7 +13,7 @@ The ES6 syntax is supported.
Import functionality modules. Import functionality modules.
```js ```js
import router from '@system.router'; import router from '@ohos.router';
``` ```
- Code reference - Code reference
......
...@@ -62,7 +62,7 @@ In the [animateMotion](../reference/arkui-js/js-components-svg-animatemotion.md) ...@@ -62,7 +62,7 @@ In the [animateMotion](../reference/arkui-js/js-components-svg-animatemotion.md)
## animateTransform Animation ## animateTransform Animation
In the [animateMotion](../reference/arkui-js/js-components-svg-animatetransform.md) child component of the **\<svg>** component, set attributeName to bind the corresponding attribute to the **transform** attribute, and set **type** to the animation type, **from** to the start value, and **to** to the end value. In the [animateTransform](../reference/arkui-js/js-components-svg-animatetransform.md) child component of the **\<svg>** component, set attributeName to bind the corresponding attribute to the **transform** attribute, and set **type** to the animation type, **from** to the start value, and **to** to the end value.
```html ```html
......
...@@ -16,7 +16,7 @@ Create a **&lt;tabs&gt;** component in the .hml file under **pages/index**. ...@@ -16,7 +16,7 @@ Create a **&lt;tabs&gt;** component in the .hml file under **pages/index**.
<text>item1</text> <text>item1</text>
<text>item2</text> <text>item2</text>
</tab-bar> </tab-bar>
<tab-content> <tab-content class="tabContent">
<div class="text"> <div class="text">
<text>content1</text> <text>content1</text>
</div> </div>
...@@ -36,6 +36,10 @@ Create a **&lt;tabs&gt;** component in the .hml file under **pages/index**. ...@@ -36,6 +36,10 @@ Create a **&lt;tabs&gt;** component in the .hml file under **pages/index**.
align-items: center; align-items: center;
background-color: #F1F3F5; background-color: #F1F3F5;
} }
.tabContent{
width: 100%;
height: 100%;
}
.text{ .text{
width: 100%; width: 100%;
height: 100%; height: 100%;
...@@ -179,10 +183,10 @@ Add the **change** event for the **&lt;tabs&gt;** component to display the index ...@@ -179,10 +183,10 @@ Add the **change** event for the **&lt;tabs&gt;** component to display the index
```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
}) })
} }
...@@ -269,7 +273,7 @@ background-color:#F1F3F5; ...@@ -269,7 +273,7 @@ background-color:#F1F3F5;
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data() { data() {
return { return {
......
...@@ -121,7 +121,7 @@ Add the **progress** method to the **\<button>** component to display the downlo ...@@ -121,7 +121,7 @@ Add the **progress** method to the **\<button>** component to display the downlo
```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();
......
...@@ -20,6 +20,8 @@ Create a **&lt;canvas&gt;** component in the .hml file under **pages/index**. ...@@ -20,6 +20,8 @@ Create a **&lt;canvas&gt;** component in the .hml file under **pages/index**.
```css ```css
/* xxx.css */ /* xxx.css */
.container{ .container{
width: 100%;
height: 100%;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
......
...@@ -27,6 +27,8 @@ Use **moveTo** and **lineTo** to draw a line segment. Use the **closePath** meth ...@@ -27,6 +27,8 @@ Use **moveTo** and **lineTo** to draw a line segment. Use the **closePath** meth
```css ```css
/* xxx.css */ /* xxx.css */
.container{ .container{
width: 100%;
height: 100%;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
...@@ -49,7 +51,6 @@ select{ ...@@ -49,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,
...@@ -324,6 +325,8 @@ Add the **createLinearGradient** and **createRadialGradient** attributes to crea ...@@ -324,6 +325,8 @@ Add the **createLinearGradient** and **createRadialGradient** attributes to crea
```css ```css
/* xxx.css */ /* xxx.css */
.container{ .container{
width: 100%;
height: 100%;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
...@@ -346,7 +349,6 @@ select{ ...@@ -346,7 +349,6 @@ select{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
export default { export default {
data:{ data:{
el: null, el: null,
...@@ -448,6 +450,8 @@ Create a text and use the **fillText** method to write the text on the canvas. U ...@@ -448,6 +450,8 @@ Create a text and use the **fillText** method to write the text on the canvas. U
```css ```css
/* xxx.css */ /* xxx.css */
.container{ .container{
width: 100%;
height: 100%;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
...@@ -470,7 +474,6 @@ select{ ...@@ -470,7 +474,6 @@ select{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt';
export default { export default {
data:{ data:{
el: null, el: null,
...@@ -592,6 +595,8 @@ After creating an image object, use the **drawImage** attribute to draw the imag ...@@ -592,6 +595,8 @@ After creating an image object, use the **drawImage** attribute to draw the imag
```css ```css
/* xxx.css */ /* xxx.css */
.container{ .container{
width: 100%;
height: 100%;
flex-direction: column; flex-direction: column;
background-color: #F1F3F5; background-color: #F1F3F5;
align-items: center; align-items: center;
...@@ -626,7 +631,7 @@ text{ ...@@ -626,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'
...@@ -669,7 +674,7 @@ export default { ...@@ -669,7 +674,7 @@ export default {
}; };
// A method is triggered when the image fails to be obtained. // A method is triggered when the image fails to be obtained.
img1.onerror = function() { img1.onerror = function() {
prompt.showToast({message:"error",duration:2000}) promptAction.showToast({message:"error",duration:2000})
}; };
}, },
rotate(){ rotate(){
...@@ -761,6 +766,8 @@ Use the **save** method to save the brush style, and use the **restore** method ...@@ -761,6 +766,8 @@ Use the **save** method to save the brush style, and use the **restore** method
```css ```css
/* xxx.css */ /* xxx.css */
.container{ .container{
width: 100%;
height: 100%;
flex-direction: column; flex-direction: column;
background-color: #F1F3F5; background-color: #F1F3F5;
align-items: center; align-items: center;
...@@ -794,7 +801,7 @@ text{ ...@@ -794,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: '',
...@@ -807,7 +814,7 @@ export default { ...@@ -807,7 +814,7 @@ export default {
save(){ save(){
// Save the brush setting. // Save the brush setting.
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);
......
...@@ -121,22 +121,22 @@ button{ ...@@ -121,22 +121,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'
}) })
}, },
......
...@@ -121,15 +121,15 @@ To submit or reset a form, add the **submit** and **reset** events. ...@@ -121,15 +121,15 @@ To submit or reset a form, add the **submit** and **reset** events.
```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'
}) })
} }
...@@ -184,6 +184,8 @@ Create two [\<Input>](../reference/arkui-js/js-components-basic-input.md) compon ...@@ -184,6 +184,8 @@ Create two [\<Input>](../reference/arkui-js/js-components-basic-input.md) compon
```css ```css
/* index.css */ /* index.css */
.container { .container {
width: 100%;
height: 100%;
flex-direction:column; flex-direction:column;
align-items:center; align-items:center;
background-color:#F1F3F5; background-color:#F1F3F5;
...@@ -200,15 +202,15 @@ label{ ...@@ -200,15 +202,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.'
}) })
} }
......
...@@ -28,6 +28,7 @@ Create a **\<grid-container>** component in the .hml file under **pages/index** ...@@ -28,6 +28,7 @@ Create a **\<grid-container>** component in the .hml file under **pages/index**
flex-direction: column; flex-direction: column;
background-color: #F1F3F5; background-color: #F1F3F5;
width: 100%; width: 100%;
height: 100%;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
...@@ -68,6 +69,7 @@ Touch the **\<grid-container>** component to call the **getColumns**, **getColum ...@@ -68,6 +69,7 @@ Touch the **\<grid-container>** component to call the **getColumns**, **getColum
flex-direction: column; flex-direction: column;
background-color: #F1F3F5; background-color: #F1F3F5;
width: 100%; width: 100%;
height: 100%;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
...@@ -76,7 +78,7 @@ Touch the **\<grid-container>** component to call the **getColumns**, **getColum ...@@ -76,7 +78,7 @@ Touch the **\<grid-container>** component to call the **getColumns**, **getColum
```js ```js
// index.js // index.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data:{ data:{
gutterWidth:'', gutterWidth:'',
...@@ -94,13 +96,13 @@ export default { ...@@ -94,13 +96,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})
}) })
}, },
} }
...@@ -155,6 +157,7 @@ After adding a **\<grid-row>** child component to **\<grid-container>**, add a * ...@@ -155,6 +157,7 @@ After adding a **\<grid-row>** child component to **\<grid-container>**, add a *
flex-direction: column; flex-direction: column;
background-color: #F1F3F5; background-color: #F1F3F5;
width: 100%; width: 100%;
height: 100%;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
...@@ -205,6 +208,7 @@ In this example, the content in the list is output cyclically to create a grid l ...@@ -205,6 +208,7 @@ In this example, the content in the list is output cyclically to create a grid l
flex-direction: column; flex-direction: column;
background-color: #F1F3F5; background-color: #F1F3F5;
width: 100%; width: 100%;
height: 100%;
} }
text{ text{
color: #0a0aef; color: #0a0aef;
......
...@@ -177,7 +177,7 @@ Add the start, pause, stop, and resume events to the **&lt;image-animator&gt;** ...@@ -177,7 +177,7 @@ Add the start, pause, stop, and resume events to the **&lt;image-animator&gt;**
```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: 'Started.' message: 'Started.'
}) })
}, },
poppause(e) { poppause(e) {
prompt.showToast({ promptAction.showToast({
message: 'Paused.' message: 'Paused.'
}) })
}, },
popstop(e) { popstop(e) {
prompt.showToast({ promptAction.showToast({
message: 'Stopped.' message: 'Stopped.'
}) })
}, },
popresume(e) { popresume(e) {
prompt.showToast({ promptAction.showToast({
message: 'Resumed.' message: 'Resumed.'
}) })
} }
......
...@@ -101,17 +101,17 @@ When the image is successfully loaded, the **complete** event is triggered, and ...@@ -101,17 +101,17 @@ When the image is successfully loaded, the **complete** event is triggered, and
```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 @@ In this example you touch and hold an image to gradually hide it. After the imag ...@@ -177,7 +177,7 @@ In this example you touch and hold an image to gradually hide it. After the imag
```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
......
...@@ -148,16 +148,16 @@ text{ ...@@ -148,16 +148,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,
}); });
...@@ -203,14 +203,14 @@ Add the **showError** method to the **&lt;input&gt;** component to display an er ...@@ -203,14 +203,14 @@ Add the **showError** method to the **&lt;input&gt;** component to display an er
```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,
}); });
...@@ -225,7 +225,7 @@ import prompt from '@system.prompt' ...@@ -225,7 +225,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 "
}); });
} }
...@@ -306,14 +306,14 @@ label { ...@@ -306,14 +306,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!'
}) })
} }
......
...@@ -163,7 +163,7 @@ margin-top:30px; ...@@ -163,7 +163,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',
...@@ -180,12 +180,12 @@ export default { ...@@ -180,12 +180,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,7 @@ option{ ...@@ -242,7 +242,7 @@ option{
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data:{ data:{
fresh: false, fresh: false,
......
...@@ -26,6 +26,8 @@ In the following example, you first create an offscreen canvas, and then create ...@@ -26,6 +26,8 @@ In the following example, you first create an offscreen canvas, and then create
```css ```css
/* xxx.css */ /* xxx.css */
.container{ .container{
width: 100%;
height: 100%;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
...@@ -47,7 +49,7 @@ select{ ...@@ -47,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,
...@@ -68,7 +70,7 @@ export default { ...@@ -68,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);
}, },
...@@ -106,6 +108,8 @@ Use **isPointInPath** to determine whether a coordinate is within the path area ...@@ -106,6 +108,8 @@ Use **isPointInPath** to determine whether a coordinate is within the path area
```css ```css
/* xxx.css */ /* xxx.css */
.container{ .container{
width: 100%;
height: 100%;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
......
...@@ -36,7 +36,7 @@ canvas { ...@@ -36,7 +36,7 @@ canvas {
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
onShow() { onShow() {
...@@ -139,7 +139,7 @@ text { ...@@ -139,7 +139,7 @@ text {
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
export default { export default {
data: { data: {
......
...@@ -144,7 +144,7 @@ Add the **change** event to confirm selection and the **cancel** event to cancel ...@@ -144,7 +144,7 @@ Add the **change** event to confirm selection and the **cancel** event to cancel
```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 @@ Implement a health check-in application by using the **\<picker>** component. ...@@ -246,7 +246,7 @@ Implement a health check-in application by using the **\<picker>** component.
```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'
......
...@@ -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:'Current Rating' + e.rating message:'Current Rating' + e.rating
}) })
} }
......
...@@ -249,7 +249,7 @@ button{ ...@@ -249,7 +249,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,
...@@ -262,20 +262,20 @@ export default { ...@@ -262,20 +262,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 indicates the sequence number of the current step. // index indicates the sequence number of the current step.
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 indicates the sequence number of the step to be redirected to. // pendingIndex indicates the sequence number of the step to be redirected to.
message: 'Current step:'+e.index+"-------Next step:"+e.pendingIndex message: 'Current step:'+e.index+"-------Next step:"+e.pendingIndex
}) })
...@@ -364,8 +364,8 @@ Use a **\<stepper>** component to navigate through the steps. Create a **\<Toggl ...@@ -364,8 +364,8 @@ Use a **\<stepper>** component to navigate through the steps. Create a **\<Toggl
```js ```js
// xxx.js // xxx.js
import prompt from '@system.prompt'; import promptAction from '@ohos.promptAction';
import router from '@system.router'; import router from '@ohos.router';
let myset = new Set(); let myset = new Set();
export default { export default {
data: { data: {
......
...@@ -262,13 +262,13 @@ select{ ...@@ -262,13 +262,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:"The switchover ends"}); promptAction.showToast({duration:2000,message:"The switchover ends"});
}, },
selectChange(e){ selectChange(e){
this.$element('swiper').swipeTo({index: Number(e.newValue)}); this.$element('swiper').swipeTo({index: Number(e.newValue)});
...@@ -344,7 +344,7 @@ swiper{ ...@@ -344,7 +344,7 @@ swiper{
```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,
......
...@@ -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";
}, },
} }
......
...@@ -111,7 +111,7 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte ...@@ -111,7 +111,7 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte
} }
``` ```
5. After the splash screen animation plays for 1 second, the **FoodCategoryList** page is displayed. Set the **onFinish** callback of **animateTo**. Invoke the **setTimeout** API of the timer. After a delay of 1s, call **router.replace** to display the **FoodCategoryList** page. 5. After the splash screen animation plays for 1 second, the **FoodCategoryList** page is displayed. Set the **onFinish** callback of **animateTo**. Invoke the **setTimeout** API of the timer. After a delay of 1s, call **router.replaceUrl** to display the **FoodCategoryList** page.
```ts ```ts
import router from '@ohos.router' import router from '@ohos.router'
...@@ -137,7 +137,7 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte ...@@ -137,7 +137,7 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte
delay: 100, delay: 100,
onFinish: () => { onFinish: () => {
setTimeout(() => { setTimeout(() => {
router.replace({ url: "pages/FoodCategoryList" }) router.replaceUrl({ url: "pages/FoodCategoryList" })
}, 1000); }, 1000);
} }
}, () => { }, () => {
...@@ -201,7 +201,7 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte ...@@ -201,7 +201,7 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte
delay: 100, delay: 100,
onFinish: () => { onFinish: () => {
setTimeout(() => { setTimeout(() => {
router.replace({ url: "pages/FoodCategoryList" }) router.replaceUrl({ url: "pages/FoodCategoryList" })
}, 1000); }, 1000);
} }
}, () => { }, () => {
...@@ -305,7 +305,7 @@ Implement the shared element transition between the food list page and the food ...@@ -305,7 +305,7 @@ Implement the shared element transition between the food list page and the food
.height(184) .height(184)
.width('100%') .width('100%')
.onClick(() => { .onClick(() => {
router.push({ url: 'pages/FoodDetail', params: { foodId: this.foodItem } }) router.pushUrl({ url: 'pages/FoodDetail', params: { foodData: this.foodItem } })
}) })
} }
} }
......
...@@ -61,7 +61,7 @@ The procedure below uses these two mechanisms for redirection between the page l ...@@ -61,7 +61,7 @@ The procedure below uses these two mechanisms for redirection between the page l
.height(184) .height(184)
.width('100%') .width('100%')
.onClick(() => { .onClick(() => {
router.push({ url: 'pages/FoodDetail' }) router.pushUrl({ url: 'pages/FoodDetail' })
}) })
} }
} }
...@@ -138,7 +138,7 @@ We have implemented the redirection and going back of the **FoodCategoryList** a ...@@ -138,7 +138,7 @@ We have implemented the redirection and going back of the **FoodCategoryList** a
The router API called by **FoodGridItem** also has supports redirection with parameters. The method of using the router API is similar to that of using the **Navigator**. The router API called by **FoodGridItem** also has supports redirection with parameters. The method of using the router API is similar to that of using the **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.
先完成此消息的编辑!
想要评论请 注册