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
| <template>
| <el-dialog
| v-model="dialogFlag"
| title="提示"
| width="500"
| align-center
| >
| <span>是否退出登录?</span>
| <template #footer>
| <div class="dialog-footer">
| <el-button @click="dialogFlag = false">取消</el-button>
| <el-button type="primary" @click="confirm()">
| 确定
| </el-button>
| </div>
| </template>
| </el-dialog>
| </template>
| <script>
| import { useSessionStore } from '@/stores/session.js'
| import { storeToRefs } from 'pinia';
|
| export default {
| setup() {
| const { resetUserInfo } = useSessionStore()
| return { resetUserInfo }
| },
| data() {
| return {
| dialogFlag: false
| }
| },
| props: {
| modelValue: {
| type: Boolean,
| default: false
| }
| },
| watch: {
| modelValue(val) {
| this.dialogFlag = val
| },
| dialogFlag(val) {
| this.$emit('update:modelValue', val)
| }
| },
| methods: {
| confirm() {
| this.dialogFlag = false
| this.$router.replace('/auth/login')
| this.resetUserInfo()
| localStorage.removeItem('dictData')
| this.$axios.post('/system/auth/logout')
| }
| }
| }
| </script>
|
|