Browse Source
Co-authored-by: songjianet <1778651752@qq.com> Co-authored-by: Jiajie Zhong <zhongjiajie955@hotmail.com>3.0.0/version-upgrade
labbomb
3 years ago
committed by
GitHub
10 changed files with 150 additions and 15 deletions
@ -0,0 +1,33 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
import { useRouter } from 'vue-router' |
||||
import type { Router } from 'vue-router' |
||||
import { MenuOption } from 'naive-ui' |
||||
|
||||
export function useMenuClick() { |
||||
const router: Router = useRouter() |
||||
|
||||
const handleMenuClick = (key: string, item: MenuOption) => { |
||||
console.log(key, item) |
||||
// router.push({ path: 'home' })
|
||||
} |
||||
|
||||
return { |
||||
handleMenuClick, |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
import { defineStore } from 'pinia' |
||||
import LanguageStore from './types' |
||||
import { useStorage } from '@vueuse/core' |
||||
import { ref } from 'vue' |
||||
|
||||
export const useLanguageStore = defineStore({ |
||||
id: 'language', |
||||
state: (): LanguageStore => ({ |
||||
storageLang: ref('') |
||||
}), |
||||
getters: { |
||||
getLang(): string | null { |
||||
return window.localStorage.getItem('lang') |
||||
}, |
||||
}, |
||||
actions: { |
||||
setLang(lang: string): void { |
||||
this.storageLang = useStorage('lang', lang) |
||||
this.storageLang = lang |
||||
}, |
||||
}, |
||||
}) |
@ -0,0 +1,24 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
import { Ref } from 'vue' |
||||
|
||||
interface LanguageStore { |
||||
storageLang: Ref |
||||
} |
||||
|
||||
export default LanguageStore |
Loading…
Reference in new issue