页面跳转,跳转拦截

This commit is contained in:
Jason
2022-09-09 14:44:55 +08:00
parent cda8b3e3b3
commit cc8fa61bea
15 changed files with 233 additions and 47 deletions

View File

@@ -7,5 +7,6 @@ export interface Link {
path: string
name?: string
type: string
params?: Record<string, any>
isTab: boolean
query?: Record<string, any>
}

View File

@@ -4,7 +4,10 @@
<div
class="link-item border border-br px-5 py-[5px] rounded-[3px] cursor-pointer mr-[10px] mb-[10px]"
v-for="(item, index) in linkList"
:class="{ 'border-primary text-primary': modelValue.path == item.path }"
:class="{
'border-primary text-primary':
modelValue.path == item.path && modelValue.name == item.name
}"
:key="index"
@click="handleSelect(item)"
>
@@ -32,16 +35,65 @@ const linkList = ref([
{
path: '/pages/index/index',
name: '商城首页',
type: LinkTypeEnum.SHOP_PAGES
type: LinkTypeEnum.SHOP_PAGES,
isTab: true
},
{
path: '/pages/news/news',
name: '文章资讯',
type: LinkTypeEnum.SHOP_PAGES
type: LinkTypeEnum.SHOP_PAGES,
isTab: true
},
{
path: '/pages/user/user',
name: '个人中心',
type: LinkTypeEnum.SHOP_PAGES,
isTab: true
},
{
path: '/pages/collection/collection',
name: '我的收藏',
type: LinkTypeEnum.SHOP_PAGES
},
{
path: '/pages/customer_service/customer_service',
name: '联系客服',
type: LinkTypeEnum.SHOP_PAGES
},
{
path: '/pages/user_set/user_set',
name: '个人设置',
type: LinkTypeEnum.SHOP_PAGES
},
{
path: '/pages/as_us/as_us',
name: '关于我们',
type: LinkTypeEnum.SHOP_PAGES
},
{
path: '/pages/user_data/user_data',
name: '个人资料',
type: LinkTypeEnum.SHOP_PAGES
},
{
path: '/pages/agreement/agreement',
name: '隐私政策',
query: {
type: 'privacy'
},
type: LinkTypeEnum.SHOP_PAGES
},
{
path: '/pages/agreement/agreement',
name: '服务协议',
query: {
type: 'service'
},
type: LinkTypeEnum.SHOP_PAGES
},
{
path: '/pages/search/search',
name: '搜索',
type: LinkTypeEnum.SHOP_PAGES
}
])

View File

@@ -16,7 +16,7 @@ export const addUnit = (value: string | number, unit = 'px') => {
* @return {Boolean}
*/
export const isEmpty = (value: unknown) => {
return value !== null && value !== '' && typeof value !== 'undefined'
return value == null && typeof value == 'undefined'
}
/**