Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
372f430b
提交
372f430b
authored
3月 19, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'ldx' into dev
上级
07baa605
c4e7d5f8
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
63 行增加
和
0 行删除
+63
-0
index.vue
src/mobile_views/index.vue
+12
-0
index.vue
src/mobile_views/promotion/index.vue
+27
-0
index.js
src/router/index.js
+15
-0
device.js
src/utils/device.js
+9
-0
没有找到文件。
src/mobile_views/index.vue
0 → 100644
浏览文件 @
372f430b
<
template
>
<div>
这里只是针对移动设备开放的页面
</div>
</
template
>
<
script
setup
>
</
script
>
<
style
scoped
>
</
style
>
\ No newline at end of file
src/mobile_views/promotion/index.vue
0 → 100644
浏览文件 @
372f430b
<
template
>
<div>
<p>
{{
url
}}
</p>
<button
@
click=
"copy"
>
复制 URL
</button>
</div>
</
template
>
<
script
setup
>
import
{
isMobile
}
from
'@/utils/device'
const
url
=
ref
(
''
)
if
(
isMobile
())
{
url
.
value
=
window
.
location
.
href
}
// 点击复制按钮复制字符串到剪切板
const
copy
=
()
=>
{
const
input
=
document
.
createElement
(
'input'
);
input
.
value
=
url
.
value
;
document
.
body
.
appendChild
(
input
);
input
.
select
();
document
.
execCommand
(
'Copy'
);
document
.
body
.
removeChild
(
input
);
alert
(
'复制成功'
);
}
</
script
>
<
style
scoped
></
style
>
\ No newline at end of file
src/router/index.js
浏览文件 @
372f430b
import
{
createWebHashHistory
,
createRouter
}
from
'vue-router'
import
{
createWebHashHistory
,
createRouter
}
from
'vue-router'
/* Layout */
/* Layout */
import
Layout
from
'@/layout'
import
Layout
from
'@/layout'
import
{
isMobile
}
from
'@/utils/device'
/**
/**
* Note: 路由配置项
* Note: 路由配置项
...
@@ -81,6 +82,15 @@ export const constantRoutes = [
...
@@ -81,6 +82,15 @@ export const constantRoutes = [
}
}
]
]
// 移动端 路由
export
const
mobileRoutes
=
[
{
path
:
'/promotion'
,
component
:
()
=>
import
(
'@/mobile_views/promotion/index'
),
hidden
:
true
}
]
// 动态路由,基于用户权限动态去加载
// 动态路由,基于用户权限动态去加载
export
const
dynamicRoutes
=
[
export
const
dynamicRoutes
=
[
{
{
...
@@ -155,6 +165,11 @@ export const dynamicRoutes = [
...
@@ -155,6 +165,11 @@ export const dynamicRoutes = [
}
}
]
]
// 判断移动端添加路由
if
(
isMobile
())
{
constantRoutes
.
push
(...
mobileRoutes
)
}
const
router
=
createRouter
({
const
router
=
createRouter
({
history
:
createWebHashHistory
(),
history
:
createWebHashHistory
(),
routes
:
constantRoutes
,
routes
:
constantRoutes
,
...
...
src/utils/device.js
0 → 100644
浏览文件 @
372f430b
export
const
isMobile
=
()
=>
{
const
userAgent
=
navigator
.
userAgent
;
const
mobileKeywords
=
[
'Android'
,
'iPhone'
,
'iPad'
,
'iPod'
,
'Mobile'
];
for
(
let
i
=
0
;
i
<
mobileKeywords
.
length
;
i
++
)
{
if
(
userAgent
.
indexOf
(
mobileKeywords
[
i
])
!==
-
1
)
{
return
true
;
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论