DEV Community

HarmonyOS
HarmonyOS

Posted on

[Sports Watch][API 6] How to add toast pop-up dialog box to the exercise table?

Read the original article:[Sports Watch][API 6] How to add toast pop-up dialog box to the exercise table?

Add the following code to the hml file

<div class="toast-message-nodelete" if="{{showToast}}" @click="toast">
 <text class="nodelete-text">
 Loading中请稍后
 </text>
</div>Copy codeCopy code
Enter fullscreen mode Exit fullscreen mode

And also add following code to js file

export default {
 data: {
 playerType: 'watch',
 showToast: false,
 timer: null
 },


// 提示内容显示控制
toast() {
    this.showToast = !this.showToast;
    this.toastTimeout = setTimeout(()=>{
        this.showToast = !this.showToast;
        clearTimeout(this.toastTimeout);
        },1400)
    }
}
Enter fullscreen mode Exit fullscreen mode

Written by Aycanur Ucar

Top comments (0)