File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed
Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change 2323 Sandbox
2424 </t-menu-item >
2525 <template #operations >
26- <t-button variant =" text" shape =" square" >
27- <template #icon >
28- <t-icon name =" ellipsis" />
29- </template >
30- </t-button >
26+ <t-dropdown :options =" [{ content: 'Sign Out', value: 'sign-out' }]" @click =" onClickDropDown" >
27+ <t-button variant =" text" shape =" square" >
28+ <template #icon >
29+ <t-icon name =" ellipsis" />
30+ </template >
31+ </t-button >
32+ </t-dropdown >
3133 </template >
3234 </t-head-menu >
3335</template >
3638import {ref } from ' vue'
3739import {useRoute , useRouter } from ' vue-router'
3840import {MenuValue } from " tdesign-vue-next" ;
41+ import {DropdownOption } from " tdesign-vue-next" ;
42+ import {useAuthStore } from " @/store" ;
3943
4044const route = useRoute ()
4145const router = useRouter ()
4246const menuValue = ref (route .name )
47+ const authStore = useAuthStore ()
4348
4449const onChange = (value : MenuValue ) => {
4550 router .push ({name: value .toString ()})
4651}
52+
53+ const onClickDropDown = (dropdownItem : DropdownOption , context : { e: MouseEvent }) => {
54+ switch (dropdownItem .value ) {
55+ case ' sign-out' :
56+ authStore .cleanToken ()
57+ router .push ({name: ' signIn' })
58+ break
59+ }
60+ }
4761 </script >
4862
4963<style scoped lang="scss">
You can’t perform that action at this time.
0 commit comments