This commit is contained in:
houjunxiang
2025-10-09 18:19:55 +08:00
parent f2ffc65094
commit 386f1e7466
1553 changed files with 284685 additions and 32820 deletions

View File

@@ -0,0 +1,18 @@
import { defineMixin } from '../vue'
export const buttonMixin = defineMixin({
props: {
lang: String,
sessionFrom: String,
sendMessageTitle: String,
sendMessagePath: String,
sendMessageImg: String,
showMessageCard: Boolean,
appParameter: String,
formType: String,
openType: String
}
})
export default buttonMixin

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
import { defineMixin } from '../vue'
export const mpMixin = defineMixin({
// #ifdef MP-WEIXIN
// 将自定义节点设置成虚拟的更加接近Vue组件的表现能更好的使用flex属性
options: {
virtualHost: true
}
// #endif
})
export default mpMixin

View File

@@ -0,0 +1,26 @@
import { defineMixin } from '../vue'
import { queryParams } from '../function/index'
export const mpShare = defineMixin({
data() {
return {
mpShare: {
title: '', // 默认为小程序名称
path: '', // 默认为当前页面路径
imageUrl: '' // 默认为当前页面的截图
}
}
},
async onLoad(options) {
var pages = getCurrentPages();
var page = pages[pages.length - 1];
this.mpShare.path = page.route + queryParams(options);
},
onShareAppMessage(res) {
if (res.from === 'button') {// 来自页面内分享按钮
console.log(res.target)
}
return this.mpShare;
}
})
export default mpShare

View File

@@ -0,0 +1,27 @@
import { defineMixin } from '../vue'
export const openType = defineMixin({
props: {
openType: String
},
methods: {
onGetUserInfo(event) {
this.$emit('getuserinfo', event.detail)
},
onContact(event) {
this.$emit('contact', event.detail)
},
onGetPhoneNumber(event) {
this.$emit('getphonenumber', event.detail)
},
onError(event) {
this.$emit('error', event.detail)
},
onLaunchApp(event) {
this.$emit('launchapp', event.detail)
},
onOpenSetting(event) {
this.$emit('opensetting', event.detail)
}
}
})

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,61 @@
import { defineMixin } from '../vue'
const MIN_DISTANCE = 10
function getDirection(x, y) {
if (x > y && x > MIN_DISTANCE) {
return 'horizontal'
}
if (y > x && y > MIN_DISTANCE) {
return 'vertical'
}
return ''
}
export const touchMixin = defineMixin({
methods: {
getTouchPoint(e) {
if (!e) {
return {
x: 0,
y: 0
}
} if (e.touches && e.touches[0]) {
return {
x: e.touches[0].pageX,
y: e.touches[0].pageY
}
} if (e.changedTouches && e.changedTouches[0]) {
return {
x: e.changedTouches[0].pageX,
y: e.changedTouches[0].pageY
}
}
return {
x: e.clientX || 0,
y: e.clientY || 0
}
},
resetTouchStatus() {
this.direction = ''
this.deltaX = 0
this.deltaY = 0
this.offsetX = 0
this.offsetY = 0
},
touchStart(event) {
this.resetTouchStatus()
const touch = this.getTouchPoint(event)
this.startX = touch.x
this.startY = touch.y
},
touchMove(event) {
const touch = this.getTouchPoint(event)
this.deltaX = touch.x - this.startX
this.deltaY = touch.y - this.startY
this.offsetX = Math.abs(this.deltaX)
this.offsetY = Math.abs(this.deltaY)
this.direction = this.direction || getDirection(this.offsetX, this.offsetY)
}
}
})