fix: 新增悬停回到首页功能,组件全局使用。

This commit is contained in:
tianyongbao
2024-12-15 21:04:11 +08:00
parent 3dc43425fa
commit cca1cfb15d
6 changed files with 89 additions and 4 deletions

View File

@@ -0,0 +1,79 @@
<template>
<view>
<movable-area class="movable-area">
<movable-view class="movable-view" :x="x" :y="y" direction="all">
<view class="newProblem" @click="newProblem">
<image src="../../static/images/tabbar/home.png"></image>
<!-- <text></text> -->
</view>
</movable-view>
</movable-area>
</view>
</template>
<script>
export default {
data() {
return {
x: 1000, // x大于默认的值就会在最右边
y: 1000
};
},
computed: {
},
methods: {
// 意见反馈
newProblem() {
uni.switchTab({url: `/pages/imaotai/iuser/list`})
}
}
};
</script>
<style lang="less">
.movable-area {
// 保持在右下角
margin-top: 200rpx;
margin-left: 100rpx;
height: calc(100vh - 300rpx);
width: calc(100vw - 150rpx);
top: 0;
left: 0;
right: 0;
bottom: 0;
position: fixed;
z-index: 99999999;
pointer-events: none; //此处要加,鼠标事件可以渗透
.movable-view {
width: 60rpx;
height: 60rpx;
pointer-events: auto; //恢复鼠标事件
.newProblem {
width: 60rpx;
height: 60rpx;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
background: #ffffff;
border-radius: 50%;
border: 1px solid #a6a6a6;
image {
width: 30rpx;
height: 30rpx;
}
text {
margin-top: 10rpx;
font-size: 16rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #000000;
}
}
}
}
</style>

View File

@@ -9,14 +9,17 @@ import directive from './directive' // directive
import { useDict } from '@/utils/dict'
import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi'
import mySelectCheckbox from '@/components/my-selectCheckbox/my-selectCheckbox.vue';
import suspend from '@/components/suspend/suspend.vue';
export function createApp() {
const app = createSSRApp(App)
app.use(store)
app.use(uviewPlus)
app.use(plugins)
// 注册全局组件
app.component('mySelectCheckbox', mySelectCheckbox);
app.component('suspend', suspend);
directive(app)
// 全局方法挂载

View File

@@ -45,6 +45,8 @@
<u-loadmore :status="status" loadingIcon="semicircle" height="88" fontSize="32rpx" @loadmore="loadmore" />
</u-list>
</view>
<!--悬浮按钮-->
<suspend></suspend>
</template>
<script setup>

View File

@@ -93,7 +93,7 @@ import { listIitem } from '@/api/imaotai/iitem.js'
const { proxy } = getCurrentInstance()
import { getDicts } from '@/api/system/dict/data.js'
import {onLoad,onReady} from "@dcloudio/uni-app";
import mySelectCheckbox from '@/components/my-selectCheckbox/my-selectCheckbox.vue';
// import mySelectCheckbox from '@/components/my-selectCheckbox/my-selectCheckbox.vue';
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
import {reactive ,toRefs,ref,computed ,getCurrentInstance }from "vue";
const title = ref("账号添加")

View File

@@ -91,7 +91,6 @@ const { proxy } = getCurrentInstance()
import { getDicts } from '@/api/system/dict/data.js'
import dayjs from 'dayjs'
import {onLoad,onReady} from "@dcloudio/uni-app";
import mySelectCheckbox from '@/components/my-selectCheckbox/my-selectCheckbox.vue';
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
import {reactive ,toRefs,ref,computed ,getCurrentInstance }from "vue";
const title = ref("账号添加")

View File

@@ -53,6 +53,8 @@
<u-loadmore :status="status" loadingIcon="semicircle" height="88" fontSize="32rpx" @loadmore="loadmore" />
</u-list>
</view>
<!--悬浮按钮-->
<suspend></suspend>
</template>
<script setup>