代码拉取完成,页面将自动刷新
//main.js添加引用
//通用组件包
import xuniComponentsBag from './xuni/xuni-components-bag'
//挂载通用组件包
Vue.component('xuni-components-bag', xuniComponentsBag);
//然后每个页面仅需要添加
<xuni-components-bag ref="xuni"></xuni-components-bag>
//每个页面都需要常规引用
<xuni-components-bag ref="xuni"></xuni-components-bag>
import xuniComponentsBag from '@/xuni/xuni-components-bag';
components:{
xuniComponentsBag
}
<xuni-components-bag
ref="xuni"
:showStatusBar="true" //APP沉浸式状态栏占位,微信小程序不生效(不需要)
:statusBarColor="'#0000ff'" //APP沉浸式状态栏占位颜色
:showBackBtn="true" //显示悬浮返回按钮,微信小程序不生效(不需要)
:whiteBackBtn="true" //悬浮返回按钮白色风格,默认黑色
:backDelta="4" //返回按钮后退页数
></xuni-components-bag>
this.$refs.xuni.showLoading();
this.$refs.xuni.hideLoading();
this.$refs.xuni.showToast({
msg:'hello!!', //必填
style:'white/black', //默认black
times:5000 //自动关闭时间,毫秒,默认3秒
});
this.$refs.xuni.showTopMsg({
msg: 'hello!', //提示内容,必填
times:2000, //自动关闭时间,毫秒,不填需用户点击遮罩关闭
status: true //默认false(不增加状态栏高度),如果是沉浸式页面,需要填true来增加顶部状态栏占位
});
this.$refs.xuni.hideTopMsg();
this.$refs.xuni.confirm({
msg: '提示内容', //必填,与image字段互斥,image字段优先级高
image: 'url', //如果填写,则msg不会被显示
confirmColor: '#ff5656', //确认按钮文本颜色,默认 #000
confirmText: '知道了', //确认按钮文本,默认 “确定”
showCancel: true, //显示取消按钮,默认 false
cancelColor: '#0800ff', //取消按钮文本颜色,默认 #888
cancelText: '稍后再说', //取消按钮文本,默认 “取消”
success: res => { //按钮点击回调
if (res.confirm) {
this.$refs.xuni.showToast({
msg: '确定触发'
});
} else {
this.$refs.xuni.showToast({
msg: '取消触发',
style: 'white'
});
}
}
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。