user-info.vue
1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<template>
<section class="header-userInfo">
<div class="button" v-for="(item, index) in items" :key="index" @click="onClick(item.key)">
<span class="button">
<img :src="item.icon" alt="" />
</span>
</div>
</section>
</template>
<script setup>
import { storeToRefs } from 'pinia';
import { useHeaderUserInfoStore } from '@/views/stores/useHeaderUserInfoStore';
import { items } from './items';
const store = useHeaderUserInfoStore();
const { setSettingModalVisible } = store;
const { isSettingModalVisible } = storeToRefs(store);
const onClick = (key) => {
switch (key) {
case 'setting':
setSettingModalVisible(!isSettingModalVisible.value);
break;
default:
break;
}
};
</script>
<style lang="less">
.header-userInfo {
display: flex;
flex-direction: row;
gap: 1px;
.button {
position: relative;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
outline: 0px;
border: 0px;
margin: 0px;
cursor: pointer;
user-select: none;
vertical-align: middle;
appearance: none;
text-decoration: none;
text-align: center;
flex: 0 0 auto;
font-size: 1.5rem;
overflow: visible;
color: rgba(0, 0, 0, 0.54);
transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
width: 28px;
height: 28px;
padding: 0px;
border-radius: 8px;
background-color: transparent;
fill: rgb(51, 51, 51);
&:hover {
background-color: rgba(0, 0, 0, 0.08);
}
}
}
</style>