第一次提交
This commit is contained in:
55
components/page/diyComponents/mixin.js
Executable file
55
components/page/diyComponents/mixin.js
Executable file
@@ -0,0 +1,55 @@
|
||||
import { urlDecode } from '@/utils/util'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {
|
||||
|
||||
/**
|
||||
* link对象点击事件
|
||||
* 支持tabBar页面
|
||||
*/
|
||||
onLink(linkObj) {
|
||||
if (!linkObj) return false
|
||||
// 跳转到指定页面
|
||||
if (linkObj.type === 'PAGE') {
|
||||
this.$navTo(linkObj.param.path, linkObj.param.query)
|
||||
}
|
||||
// 跳转到自定义路径
|
||||
if (linkObj.type === 'CUSTOM') {
|
||||
this.$navTo(linkObj.param.path, urlDecode(linkObj.param.queryStr))
|
||||
}
|
||||
// 跳转到微信小程序
|
||||
// #ifdef MP-WEIXIN
|
||||
if (linkObj.type === 'MP-WEIXIN') {
|
||||
uni.navigateToMiniProgram({
|
||||
appId: linkObj.param.appId,
|
||||
path: linkObj.param.path
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
// 跳转到H5外部链接
|
||||
if (linkObj.type === 'URL') {
|
||||
// #ifdef H5
|
||||
window.open(linkObj.param.url)
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.openWeb(linkObj.param.url)
|
||||
// #endif
|
||||
// #ifdef MP
|
||||
uni.setClipboardData({
|
||||
data: linkObj.param.url,
|
||||
success: () =>
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '链接已复制'
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
return true
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user