| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- type TouchItem = { __$originalPosition?: UTSSourceMapPosition<"TouchItem", "components/u-floating/u-floating.vue", 9, 7>;
- clientX : number
- clientY : number
- }
- type TouchEvent = { __$originalPosition?: UTSSourceMapPosition<"TouchEvent", "components/u-floating/u-floating.vue", 13, 7>;
- touches : Array<TouchItem>
- }
- const __sfc__ = defineComponent({
- name: 'FloatingButton',
- data() {
- return {
- top: 430,
- left: 20,
- startX: 0,
- startY: 0,
- dragging: false
- };
- },
- methods: {
- onTouchStart(event : TouchEvent) {
- this.startX = event.touches[0].clientX
- this.startY = event.touches[0].clientY
- this.dragging = true
- },
- onTouchMove(event : TouchEvent) {
- if (this.dragging) {
- const deltaX = event.touches[0].clientX - this.startX
- const deltaY = event.touches[0].clientY - this.startY
- this.startX = event.touches[0].clientX
- this.startY = event.touches[0].clientY
- this.top += deltaY
- this.left += deltaX
- }
- },
- onTouchEnd() {
- this.dragging = false
- }
- }
- })
- export default __sfc__
- function GenComponentsUFloatingUFloatingRender(this: InstanceType<typeof __sfc__>): any | null {
- const _ctx = this
- const _cache = this.$.renderCache
- return _cE("view", _uM({
- class: "floating-button",
- style: _nS(_uM({ top: _ctx.top + 'px', left: _ctx.left + 'px' })),
- onTouchstart: _ctx.onTouchStart,
- onTouchmove: _ctx.onTouchMove,
- onTouchend: _ctx.onTouchEnd
- }), [
- _cE("text", _uM({
- class: "textIcon icon-jingwuicon_svg-",
- style: _nS(_uM({"font-size":"60rpx","color":"#FF4D4D"}))
- }), null, 4 /* STYLE */)
- ], 44 /* STYLE, PROPS, NEED_HYDRATION */, ["onTouchstart", "onTouchmove", "onTouchend"])
- }
- export type UFloatingComponentPublicInstance = InstanceType<typeof __sfc__>;
- const GenComponentsUFloatingUFloatingStyles = [_uM([["floating-button", _pS(_uM([["position", "fixed"], ["zIndex", 9999], ["backgroundColor", "#ffffff"], ["paddingTop", "20rpx"], ["paddingRight", "20rpx"], ["paddingBottom", "20rpx"], ["paddingLeft", "20rpx"], ["borderTopLeftRadius", "35rpx"], ["borderTopRightRadius", "35rpx"], ["borderBottomRightRadius", "35rpx"], ["borderBottomLeftRadius", "35rpx"], ["width", "70rpx"], ["height", "70rpx"], ["display", "flex"], ["justifyContent", "center"], ["alignItems", "center"], ["boxShadow", "0 4rpx 10rpx rgba(0, 0, 0, 0.3)"]]))]])]
|