HarmonyOS 鸿蒙中实现一个toast弹窗的封装

HarmonyOS 鸿蒙中实现一个toast弹窗的封装

import promptAction from '@ohos.promptAction’


export default function showToast(message: string, duration: number = 2000) {
try {
promptAction.showToast({
message: message,
duration: duration,
bottom: “center”,
})
} catch (error) {
console.error(showToast args error code is ${error.code}, message is ${error.message});
}
}


更多关于HarmonyOS 鸿蒙中实现一个toast弹窗的封装的实战教程也可以访问 https://www.itying.com/category-93-b0.html

回到顶部