cordova vue 悬浮窗提示
程序员文章站
2022-03-26 21:39:30
...
cordova 项目中
cordova plugin add cordova-plugin-x-toast
vue项目中引入
引入Toast.js
index.html 中
<script type="text/javascript" src="Toast.js"></script>
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200410161222174.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM2MTIwMzQy,size_16,color_FFFFFF,t_70)
vue项目中使用
window.plugins.toast.showWithOptions(
{
message: message,
duration: "2000", // which is 2000 ms. "long" is 4000. Or specify the nr of ms yourself.
position: "top",
addPixelsY: 0 // added a negative value to move it up a bit (default 0)
},
function(args) {
console.log("toast args: ", args.event);
//This will print 'hide'
},
function(error) {
console.error("toast error: ", error);
}
);
打包使用
效果图