This commit is contained in:
2025-04-29 13:26:19 +08:00
parent 6e1ae24845
commit bf88fcb395
73 changed files with 12939 additions and 4637 deletions

View File

@@ -1,42 +1,37 @@
<template>
<view class="float-container">
<!-- 子菜单按钮 -->
<view v-for="(item, index) in menus" :key="index" class="sub-btn" :style="getPosition(index)"
:class="{active: isOpen}" @click.stop="handleClick(item.action)">
{{ item.title }}
</view>
<!-- 主按钮 -->
<view class="main-btn" :class="{active: isOpen}" @click.stop="toggleMenu()">
<view v-for="(item,index) of props.type" :key="index">
<view class="sub-btn" :style="getPosition(index)" v-if="item === 'defaultPopup'"
:class="{active: isOpen}" @click.stop="handleClick('defaultPopup')">
<span>{{ t('public.mrz') }}</span>
</view>
<view class="sub-btn" :style="getPosition(index)" v-if="item === 'scanRecord'"
:class="{active: isOpen}" @click.stop="handleClick('scanRecord')">
<span>{{ t('public.smjl') }}</span>
</view>
</view>
<view class="main-btn" :class="{active: isOpen}" @click.stop="toggleMenu()"></view>
</view>
</template>
<script lang="ts" setup>
import {
reactive,
ref
} from 'vue';
let isOpen = ref(false);
let menus = reactive([{
title: '默认值',
action: 'default'
},
{
title: '扫描记录',
action: 'scan'
},
]);
let showPopup = ref(false);
// 父组件方法
import { reactive, ref, defineEmits,defineProps } from 'vue';
import i18n from '../../locale/index'
import { useI18n } from 'vue-i18n'
const getI18n = useI18n()
const { t, locale } = getI18n
const emit = defineEmits(['scanRecord', 'defaultPopup']);
const toggleMenu = () => {
isOpen.value = !isOpen.value;
}
const props = defineProps({
type:{
type:Array,
default: () => {
return ['scanRecord','defaultPopup']
}
}
})
const isOpen = ref(false);
const showPopup = ref(false);
const toggleMenu = () => { isOpen.value = !isOpen.value; }
const getPosition = (index:any) => {
if (!isOpen.value) return {}
return {
@@ -44,19 +39,11 @@
}
}
const handleClick = (action:any) => {
if (action == 'scan') {
emit('scanRecord');
} else if (action == 'default') {
emit('defaultPopup');
}
emit(action);
isOpen.value = !isOpen.value;
}
const open = () => {
showPopup.value = true;
}
const close = () => {
showPopup.value = false;
}
const open = () => { showPopup.value = true; }
const close = () => { showPopup.value = false; }
</script>
<style scoped lang="scss">