This commit is contained in:
Xou 2024-04-28 09:22:34 +08:00
parent d5b1a47cbb
commit a295ca2166
9 changed files with 23 additions and 23 deletions

View File

@ -11,8 +11,8 @@ export function setupRouterGuard(router: Router) {
router.beforeEach(async (to, from, next) => {
// 判断是否是外链,如果是直接打开网页并拦截跳转
if (to.meta.herf) {
window.open(to.meta.herf)
if (to.meta.href) {
window.open(to.meta.href)
return false
}
// 开始 loadingBar

View File

@ -260,7 +260,7 @@ export const staticRoutes: AppRoute.RowRoute[] = [
'meta.title': 'VueUse外链',
'meta.requiresAuth': true,
'meta.icon': 'logos:vueuse',
'meta.herf': 'https://vueuse.org/guide/',
'meta.href': 'https://vueuse.org/guide/',
'componentPath': 'null',
'id': 27,
'pid': 24,

View File

@ -1,7 +1,7 @@
import { blankInstance, request } from '../http'
/* get方法测试 */
export function fetachGet(params?: any) {
export function fetchGet(params?: any) {
return request.Get('/getAPI', { params })
}
@ -53,7 +53,7 @@ export function dictData() {
export function getBlob(url: string) {
const methodInstance = blankInstance.Get<Blob>(url)
methodInstance.meta = {
// 标识为bolb数据
// 标识为blob数据
isBlob: true,
}
return methodInstance
@ -66,7 +66,7 @@ export function downloadFile(url: string) {
enableDownload: true,
})
methodInstance.meta = {
// 标识为bolb数据
// 标识为blob数据
isBlob: true,
}
return methodInstance

View File

@ -18,7 +18,7 @@ declare namespace AppRoute {
/* 菜单排序。 */
order?: number
/* 嵌套外链 */
herf?: string
href?: string
/** 当前路由不在左侧菜单显示,但需要高亮某个菜单的情况 */
activeMenu?: string
/** 当前路由是否会被添加到Tab中 */

View File

@ -5,7 +5,7 @@ const text = ref('nova-admin')
<template>
<n-card title="二维码">
<n-alert :show-icon="false" type="info">
使用navieUI - QR Code 实现
使用naiveUI - QR Code 实现
</n-alert>
<n-qr-code :value="text" />
<n-input v-model:value="text" :maxlength="60" type="text" />

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import {
fetachGet,
fetchGet,
} from '@/service'
const emit = defineEmits<{
@ -8,7 +8,7 @@ const emit = defineEmits<{
}>()
async function pinterEnv() {
const res = await fetachGet({ a: 112211, b: false })
const res = await fetchGet({ a: 112211, b: false })
emit('update', res)
}
</script>

View File

@ -1,21 +1,21 @@
<script setup lang="ts">
import { useRequest } from 'alova'
import {
fetachGet,
fetchGet,
} from '@/service'
const emit = defineEmits<{
update: [data: any] //
}>()
const { data: fetachGetData, send: sendFetachGet } = useRequest(fetachGet({ a: 112211 }), {
const { data: fetchGetData, send: sendFetchGet } = useRequest(fetchGet({ a: 112211 }), {
// immediatefalse
immediate: false,
})
async function handleRequestHook() {
await sendFetachGet()
emit('update', fetachGetData.value)
await sendFetchGet()
emit('update', fetchGetData.value)
}
</script>

View File

@ -7,9 +7,9 @@ import {
dictData,
downloadFile,
expiredTokenRequest,
fetachGet,
fetchDelete,
fetchFormPost,
fetchGet,
fetchPost,
fetchPut,
fetchUpdateToken,
@ -18,20 +18,20 @@ import {
} from '@/service'
const msg = ref()
const { data: fetachGetData, send: sendFetachGet } = useRequest(fetachGet({ a: 112211 }), {
const { data: fetchGetData, send: sendFetchGet } = useRequest(fetchGet({ a: 112211 }), {
// immediatefalse
immediate: false,
})
function handleRequestHook() {
sendFetachGet()
msg.value = fetachGetData.value
sendFetchGet()
msg.value = fetchGetData.value
}
function pinterEnv() {
msg.value = import.meta.env
}
async function get() {
const res = await fetachGet({ a: 112211, b: false })
const res = await fetchGet({ a: 112211, b: false })
msg.value = res
}
function delete2() {

View File

@ -32,7 +32,7 @@ const defaultFormModal: AppRoute.RowRoute = {
'meta.keepAlive': false,
'meta.hide': false,
'meta.order': undefined,
'meta.herf': undefined,
'meta.href': undefined,
'meta.activeMenu': undefined,
'meta.withoutTab': true,
'meta.pinTab': false,
@ -160,7 +160,7 @@ const rules = {
message: '请输入菜单标题',
trigger: 'blur',
},
'meta.herf': {
'meta.href': {
validator(rule: FormItemRule, value: string) {
if (!new RegExp(Regex.Url).test(value))
return new Error('请输入正确的URL地址')
@ -244,12 +244,12 @@ const options = [
</template>
<n-input-number v-model:value="formModel['meta.order']" />
</n-form-item-grid-item>
<n-form-item-grid-item v-if="formModel['meta.menuType'] === 'page'" :span="1" path="meta.herf">
<n-form-item-grid-item v-if="formModel['meta.menuType'] === 'page'" :span="1" path="meta.href">
<template #label>
外链页面
<HelpInfo message="填写后,点击菜单将跳转到该地址,组件路径任意填写" />
</template>
<n-input v-model:value="formModel['meta.herf']" placeholder="Eg: https://example.com" />
<n-input v-model:value="formModel['meta.href']" placeholder="Eg: https://example.com" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="1" label="登录访问" path="meta.requiresAuth">
<n-switch v-model:value="formModel['meta.requiresAuth']" />