当前位置: 首页 > wzjs >正文

网站建设素材网免费获客平台

网站建设素材网,免费获客平台,用英文介绍购物网站,最近韩国电影片在线观看免费高清中文一、最终效果 二、具体详情请看movable-area与movable-view官方文档说明 三、参数配置 1、代码示例 <TFab title"新建订单" click"addOrder" /> // title:表按钮文案 // addOrder:点击按钮事件四、组件源码 <template><movable-area cl…

一、最终效果

在这里插入图片描述

二、具体详情请看movable-area与movable-view官方文档说明

三、参数配置

1、代码示例

<TFab title="新建订单" @click="addOrder" />
// title:表按钮文案
// addOrder:点击按钮事件

四、组件源码

<template><movable-area class="movable-area" @touchend="onTouchend"><movable-view class="movable-view" :x="x" :y="y" direction="all" @change="onChange"><view class="addBtn" :style="{ width: `${width}px` , height: `${height}px`}" @tap="handleClick">{{title}}</view><slot /></movable-view></movable-area>
</template><script lang="ts" setup>
import { debounce } from "@/utils";
defineProps({title: {type: String},width: {type: Number,default: 40},height: {type: Number,default: 40}
});
const emits = defineEmits(["click"]);
const x = ref(0);
const y = ref(0);
const screenWidth = ref(0);
const screenHeight = ref(0);onMounted(() => {uni.getSystemInfo({success: res => {screenWidth.value = res.windowWidth;screenHeight.value = res.windowHeight;// 初始位置在屏幕右下角y.value = screenHeight.value - 200;x.value = screenWidth.value - 70;}});
});
// 拖动坐标更新(防抖)
const onChange = (e: { detail: { x: number; y: number } }) => {debounce(() => {x.value = e.detail.x;y.value = e.detail.y;}, 500);
};
// 触摸结束时吸附边缘
const onTouchend = () => {nextTick(() => {const threshold = 50; // 吸附阈值(rpx)if (Math.abs(x.value - 0) < threshold) {x.value = 0;} else if (Math.abs(x.value - screenWidth.value) < threshold) {x.value = screenWidth.value;}if (Math.abs(y.value - 0) < threshold) {y.value = 0;} else if (Math.abs(y.value - screenHeight.value) < threshold) {y.value = screenHeight.value;}});
};
const handleClick = () => {emits("click");
};
</script><style lang="scss">
.movable-area {position: fixed;top: 0;left: 0;width: 100vw;height: calc(100vh - 100px); // 可根据自己的项目来计算pointer-events: none; /* 关键样式 */z-index: 9999;.movable-view {pointer-events: auto; /* 关键样式 */width: 100rpx;height: 100rpx;will-change: transform;.addBtn {border-radius: 50%;width: 40px;height: 40px;overflow: hidden;display: flex;justify-content: center;align-items: center;color: #fff;font-size: 14px;padding: 8px;box-shadow: 0 1px 5px 2px rgba(0, 0, 0, 0.3);background: #355db4;text-align: center;}}
}
</style>

相关文章

基于ElementUi再次封装基础组件文档


vue3+ts基于Element-plus再次封装基础组件文档

http://www.dtcms.com/wzjs/164188.html

相关文章:

  • 企业网站的制作网络推广网站大全
  • 专门做壁纸的网站百度竞价排名怎么做
  • 云南省建设厅合同网站写手代写平台
  • 建设中心小学网站新闻网站软文平台
  • 企业qq邮箱登录入口关键词优化的软件
  • 4399网站开发百度热线电话
  • 做网站不备案宁波网站推广营销
  • 网站开发 居易国际百度广告怎么做
  • 网站上的支付接口怎么做跨境电商平台有哪些
  • 信息技术课做网站seo关键词优化排名外包
  • 免费做文字图网站2345网址导航设置
  • 设计个人网站模板百度站长平台快速收录
  • 珠海做网站找哪家好百度搜索引擎官网
  • 套模板的网站多少钱广东公司搜索seo哪家强
  • 用visual做的网站友情链接的作用有哪些
  • 郑州 服装 网站建设百度广告联盟赚广告费
  • 页面设计尺寸规范seo搜索引擎优化推广
  • 免费商城版网站制作深圳百度关键
  • 怎么把淘宝店放到自己做的网站去seo推广主要做什么的
  • wordpress阿里云https搜索引擎优化指的是什么
  • 网站建设和管理心得南宁百度关键词排名公司
  • 酒店管理系统无锡seo网站管理
  • wordpress 加文章分享杭州网站seo推广
  • 金藏源电商网站建设公司怎么做推广和宣传平台
  • 佛山营销网站建设联系方式新媒体平台
  • 哪个网站专业做安防中国seo谁最厉害
  • 上虞网站设计百度app下载
  • 花卉网站建设策划方案谷歌seo最好的公司
  • WordPress全站跳转seo诊断分析在线工具
  • 南岗哈尔滨网站建设甘肃网站推广