File tree 6 files changed +85
-85
lines changed
6 files changed +85
-85
lines changed Original file line number Diff line number Diff line change @@ -17,23 +17,23 @@ import { languages } from "@/i18n/index";
17
17
18
18
export default defineComponent ({
19
19
setup() {
20
- const route = useRoute (),
21
- router = useRouter (),
22
- i18n = useI18n (),
23
- selectedValue = ref (i18n .locale .value ),
24
- updateValue = (event : Event ) => {
25
- const basePath = (() => {
26
- if (route .params .lang ) {
27
- return route .path .slice (route .params .lang .length + 1 );
28
- }
29
- return route .path ;
30
- })(),
31
- target = event .target as HTMLSelectElement ,
32
- newPath = ` /${target .value }${basePath } ` ;
33
- if (newPath !== route .path ) {
34
- router .push (newPath );
35
- }
36
- };
20
+ const route = useRoute ();
21
+ const router = useRouter ();
22
+ const i18n = useI18n ();
23
+ const selectedValue = ref (i18n .locale .value );
24
+ const updateValue = (event : Event ) => {
25
+ const basePath = (() => {
26
+ if (route .params .lang ) {
27
+ return route .path .slice (route .params .lang .length + 1 );
28
+ }
29
+ return route .path ;
30
+ })(),
31
+ target = event .target as HTMLSelectElement ,
32
+ newPath = ` /${target .value }${basePath } ` ;
33
+ if (newPath !== route .path ) {
34
+ router .push (newPath );
35
+ }
36
+ };
37
37
return {
38
38
languages ,
39
39
selectedValue ,
Original file line number Diff line number Diff line change @@ -47,9 +47,9 @@ export default defineComponent({
47
47
MenuList ,
48
48
},
49
49
setup() {
50
- const store = useStore (),
51
- user = reactive <UserData >({ user: null }),
52
- menu = ref (false );
50
+ const store = useStore ();
51
+ const user = reactive <UserData >({ user: null });
52
+ const menu = ref (false );
53
53
54
54
useI18nParam ();
55
55
Original file line number Diff line number Diff line change @@ -25,14 +25,14 @@ export default defineComponent({
25
25
},
26
26
emits: [emitClose ],
27
27
setup(__ , ctx ) {
28
- const store = useStore (),
29
- handleClose = () => {
30
- ctx .emit (emitClose );
31
- },
32
- logout = () => {
33
- signOut (auth );
34
- ctx .emit (emitClose );
35
- };
28
+ const store = useStore ();
29
+ const handleClose = () => {
30
+ ctx .emit (emitClose );
31
+ };
32
+ const logout = () => {
33
+ signOut (auth );
34
+ ctx .emit (emitClose );
35
+ };
36
36
return {
37
37
handleClose ,
38
38
logout ,
Original file line number Diff line number Diff line change @@ -9,49 +9,49 @@ import About from "@/views/About.vue";
9
9
import MyPage from "@/views/MyPage.vue" ;
10
10
11
11
const routeChildren : Array < RouteRecordRaw > = [
12
- {
13
- path : "" ,
14
- component : Home ,
15
- } ,
16
- {
17
- path : "about" ,
18
- component : About ,
19
- } ,
20
- {
21
- path : "account" ,
22
- component : Account ,
23
- } ,
24
- {
25
- path : "mypage" ,
26
- component : MyPage ,
27
- } ,
28
- ] ,
29
- routes : Array < RouteRecordRaw > = [
30
- {
31
- path : "/" ,
32
- component : Layout ,
33
- children : [
34
- {
35
- path : "/:lang" ,
36
- component : Blank ,
37
- children : routeChildren ,
38
- } ,
39
- {
40
- path : "" ,
41
- component : Blank ,
42
- children : routeChildren ,
43
- } ,
44
- ] ,
45
- } ,
46
- {
47
- path : "/:page(.*)" ,
48
- name : "NotFoundPage" ,
49
- component : NotFound ,
50
- } ,
51
- ] ,
52
- router = createRouter ( {
53
- history : createWebHistory ( import . meta. env . BASE_URL ) ,
54
- routes,
55
- } ) ;
12
+ {
13
+ path : "" ,
14
+ component : Home ,
15
+ } ,
16
+ {
17
+ path : "about" ,
18
+ component : About ,
19
+ } ,
20
+ {
21
+ path : "account" ,
22
+ component : Account ,
23
+ } ,
24
+ {
25
+ path : "mypage" ,
26
+ component : MyPage ,
27
+ } ,
28
+ ] ;
29
+ const routes : Array < RouteRecordRaw > = [
30
+ {
31
+ path : "/" ,
32
+ component : Layout ,
33
+ children : [
34
+ {
35
+ path : "/:lang" ,
36
+ component : Blank ,
37
+ children : routeChildren ,
38
+ } ,
39
+ {
40
+ path : "" ,
41
+ component : Blank ,
42
+ children : routeChildren ,
43
+ } ,
44
+ ] ,
45
+ } ,
46
+ {
47
+ path : "/:page(.*)" ,
48
+ name : "NotFoundPage" ,
49
+ component : NotFound ,
50
+ } ,
51
+ ] ;
52
+ const router = createRouter ( {
53
+ history : createWebHistory ( import . meta. env . BASE_URL ) ,
54
+ routes,
55
+ } ) ;
56
56
57
57
export default router ;
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ import { computed, ref } from "vue";
3
3
import { User } from "firebase/auth" ;
4
4
5
5
export const useStore = defineStore ( "store" , ( ) => {
6
- const user = ref < User | null | undefined > ( undefined ) ,
7
- setUser = ( _user : User | null ) => {
8
- user . value = _user ;
9
- } ,
10
- isSignedIn = computed ( ( ) => user . value !== null && user . value !== undefined ) ;
6
+ const user = ref < User | null | undefined > ( undefined ) ;
7
+ const setUser = ( _user : User | null ) => {
8
+ user . value = _user ;
9
+ } ;
10
+ const isSignedIn = computed ( ( ) => user . value !== null && user . value !== undefined ) ;
11
11
return {
12
12
user,
13
13
setUser,
Original file line number Diff line number Diff line change @@ -13,14 +13,14 @@ export const useIsSignedIn = () => {
13
13
} ;
14
14
15
15
export const useLang = ( ) => {
16
- const i18n = useI18n ( ) ,
17
- lang = computed ( ( ) => i18n . locale . value ) ,
18
- localizedUrl = ( path : string ) => {
19
- if ( lang . value ) {
20
- return `/${ lang . value } ${ path } ` ;
21
- }
22
- return path ;
23
- } ;
16
+ const i18n = useI18n ( ) ;
17
+ const lang = computed ( ( ) => i18n . locale . value ) ;
18
+ const localizedUrl = ( path : string ) => {
19
+ if ( lang . value ) {
20
+ return `/${ lang . value } ${ path } ` ;
21
+ }
22
+ return path ;
23
+ } ;
24
24
25
25
return {
26
26
lang,
You can’t perform that action at this time.
0 commit comments