feat(Breadcrumbe): Add Breadcrumb component
style: change function to arrow function
This commit is contained in:
@@ -6,8 +6,8 @@ import { config } from '@/config/axios/config'
|
||||
|
||||
const { default_headers } = config
|
||||
|
||||
export function useAxios() {
|
||||
function request(option: AxiosConfig): AxiosPromise {
|
||||
export const useAxios = () => {
|
||||
const request = (option: AxiosConfig): AxiosPromise => {
|
||||
const { url, method, params, data, headersType, responseType } = option
|
||||
return service({
|
||||
url: url,
|
||||
|
||||
@@ -6,7 +6,7 @@ import WebStorageCache from 'web-storage-cache'
|
||||
|
||||
type CacheType = 'sessionStorage' | 'localStorage'
|
||||
|
||||
export function useCache(type: CacheType = 'sessionStorage') {
|
||||
export const useCache = (type: CacheType = 'sessionStorage') => {
|
||||
const wsCache: WebStorageCache = new WebStorageCache({
|
||||
storage: type
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { inject } from 'vue'
|
||||
|
||||
export function useConfigGlobal() {
|
||||
export const useConfigGlobal = () => {
|
||||
const configGlobal = inject('configGlobal', {}) as ConfigGlobalTypes
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import variables from '@/styles/variables.module.less'
|
||||
|
||||
export function useDesign() {
|
||||
export const useDesign = () => {
|
||||
const lessVariables = variables
|
||||
|
||||
/**
|
||||
* @param scope 类名
|
||||
* @returns 返回空间名-类名
|
||||
*/
|
||||
function getPrefixCls(scope: string) {
|
||||
const getPrefixCls = (scope: string) => {
|
||||
return `${lessVariables.namespace}-${scope}`
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Form, FormExpose } from '@/components/Form'
|
||||
import type { ElForm } from 'element-plus'
|
||||
import { ref, unref, nextTick } from 'vue'
|
||||
|
||||
export function useForm() {
|
||||
export const useForm = () => {
|
||||
// From实例
|
||||
const formRef = ref<typeof Form & FormExpose>()
|
||||
|
||||
@@ -13,12 +13,12 @@ export function useForm() {
|
||||
* @param ref Form实例
|
||||
* @param elRef ElForm实例
|
||||
*/
|
||||
function register(ref: typeof Form & FormExpose, elRef: ComponentRef<typeof ElForm>) {
|
||||
const register = (ref: typeof Form & FormExpose, elRef: ComponentRef<typeof ElForm>) => {
|
||||
formRef.value = ref
|
||||
elFormRef.value = elRef
|
||||
}
|
||||
|
||||
async function getForm() {
|
||||
const getForm = async () => {
|
||||
const form = unref(formRef)
|
||||
if (!form) {
|
||||
console.error('The form is not registered. Please use the register method to register')
|
||||
|
||||
@@ -11,7 +11,7 @@ type I18nGlobalTranslation = {
|
||||
|
||||
type I18nTranslationRestParameters = [string, any]
|
||||
|
||||
function getKey(namespace: string | undefined, key: string) {
|
||||
const getKey = (namespace: string | undefined, key: string) => {
|
||||
if (!namespace) {
|
||||
return key
|
||||
}
|
||||
@@ -21,9 +21,11 @@ function getKey(namespace: string | undefined, key: string) {
|
||||
return `${namespace}.${key}`
|
||||
}
|
||||
|
||||
export function useI18n(namespace?: string): {
|
||||
export const useI18n = (
|
||||
namespace?: string
|
||||
): {
|
||||
t: I18nGlobalTranslation
|
||||
} {
|
||||
} => {
|
||||
const normalFn = {
|
||||
t: (key: string) => {
|
||||
return getKey(namespace, key)
|
||||
|
||||
@@ -2,6 +2,6 @@ import { h } from 'vue'
|
||||
import type { VNode } from 'vue'
|
||||
import { Icon } from '@/components/Icon'
|
||||
|
||||
export function useIcon(props: IconTypes): VNode {
|
||||
export const useIcon = (props: IconTypes): VNode => {
|
||||
return h(Icon, props)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { i18n } from '@/plugins/vueI18n'
|
||||
import { useLocaleStoreWithOut } from '@/store/modules/locale'
|
||||
import { setHtmlPageLang } from '@/plugins/vueI18n/helper'
|
||||
|
||||
function setI18nLanguage(locale: LocaleType) {
|
||||
const setI18nLanguage = (locale: LocaleType) => {
|
||||
const localeStore = useLocaleStoreWithOut()
|
||||
|
||||
if (i18n.mode === 'legacy') {
|
||||
@@ -16,10 +16,10 @@ function setI18nLanguage(locale: LocaleType) {
|
||||
setHtmlPageLang(locale)
|
||||
}
|
||||
|
||||
export function useLocale() {
|
||||
export const useLocale = () => {
|
||||
// Switching the language will change the locale of useI18n
|
||||
// And submit to configuration modification
|
||||
async function changeLocale(locale: LocaleType) {
|
||||
const changeLocale = async (locale: LocaleType) => {
|
||||
const globalI18n = i18n.global
|
||||
|
||||
const langModule = await import(`../../locales/${locale}.ts`)
|
||||
|
||||
@@ -6,11 +6,10 @@ import { useCssVar } from '@vueuse/core'
|
||||
|
||||
const primaryColor = useCssVar('--el-color-primary', document.documentElement)
|
||||
|
||||
export function useNProgress() {
|
||||
export const useNProgress = () => {
|
||||
NProgress.configure({ showSpinner: false } as NProgressOptions)
|
||||
initColor()
|
||||
|
||||
async function initColor() {
|
||||
const initColor = async () => {
|
||||
await nextTick()
|
||||
const bar = document.getElementById('nprogress')?.getElementsByClassName('bar')[0] as ElRef
|
||||
if (bar) {
|
||||
@@ -18,11 +17,13 @@ export function useNProgress() {
|
||||
}
|
||||
}
|
||||
|
||||
function start() {
|
||||
initColor()
|
||||
|
||||
const start = () => {
|
||||
NProgress.start()
|
||||
}
|
||||
|
||||
function done() {
|
||||
const done = () => {
|
||||
NProgress.done()
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useI18n } from '@/hooks/web/useI18n'
|
||||
|
||||
const appStore = useAppStoreWithOut()
|
||||
|
||||
export function useTitle(newTitle?: string) {
|
||||
export const useTitle = (newTitle?: string) => {
|
||||
const { t } = useI18n()
|
||||
const title = ref(
|
||||
newTitle ? `${appStore.getTitle} - ${t(newTitle as string)}` : appStore.getTitle
|
||||
|
||||
Reference in New Issue
Block a user