69 lines
1.2 KiB
Vue
69 lines
1.2 KiB
Vue
<template>
|
|
<view class="float-menu-card">
|
|
<view
|
|
v-for="(item, index) in list"
|
|
:key="index"
|
|
class="menu-item"
|
|
:class="{ 'last-item': index === list.length - 1 }"
|
|
@click="handleItemClick(item, index)"
|
|
>
|
|
<text class="menu-text">{{ item.title }}</text>
|
|
<text class="arrow">></text>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'FloatMenuCard',
|
|
props: {
|
|
list: {
|
|
type: Array,
|
|
default: () => []
|
|
}
|
|
},
|
|
methods: {
|
|
handleItemClick(item, index) {
|
|
// 发出事件,让父组件处理跳转逻辑
|
|
this.$emit('item-click', { item, index });
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.float-menu-card {
|
|
position: fixed;
|
|
bottom: 40rpx;
|
|
left: 28rpx;
|
|
right: 28rpx;
|
|
background: #fff;
|
|
border-radius: 16rpx;
|
|
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.1);
|
|
overflow: hidden;
|
|
z-index: 100;
|
|
}
|
|
|
|
.menu-item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 32rpx 28rpx;
|
|
border-bottom: 1rpx solid #f5f5f5;
|
|
}
|
|
|
|
.menu-item:last-child,
|
|
.menu-item.last-item {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.menu-text {
|
|
font-size: 30rpx;
|
|
color: #333;
|
|
}
|
|
|
|
.arrow {
|
|
font-size: 28rpx;
|
|
color: #ccc;
|
|
}
|
|
</style> |