Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c450f425
authored
Jun 25, 2025
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
循环获取wv设置webview宽度
1 parent
859f0dcf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
components/HomeFrame/index.vue
components/HomeFrame/index.vue
View file @
c450f42
...
@@ -290,7 +290,7 @@ export default {
...
@@ -290,7 +290,7 @@ export default {
const
setWebviewStyle
=
()
=>
{
const
setWebviewStyle
=
()
=>
{
//修改UA为PC端
//修改UA为PC端
// plus.navigator.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0')
// plus.navigator.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0')
setTimeout
(
()
=>
{
const
setWebviewStyleWithRetry
=
()
=>
{
const
currentWebview
=
this
.
$parent
.
$scope
.
$getAppWebview
();
const
currentWebview
=
this
.
$parent
.
$scope
.
$getAppWebview
();
const
wv
=
currentWebview
.
children
()[
1
];
const
wv
=
currentWebview
.
children
()[
1
];
...
@@ -301,10 +301,23 @@ export default {
...
@@ -301,10 +301,23 @@ export default {
height
:
'97%'
,
height
:
'97%'
,
width
:
'92%'
width
:
'92%'
});
});
return
true
;
// 成功设置样式
}
else
{
}
else
{
this
.
jumpUrl
=
''
;
return
false
;
// 未找到wv
}
}
},
100
);
};
const
retrySetWebviewStyle
=
()
=>
{
if
(
!
setWebviewStyleWithRetry
())
{
// 如果未成功,继续重试
setTimeout
(
retrySetWebviewStyle
,
50
);
}
else
{
// 成功设置样式,结束循环
console
.
log
(
'Webview样式设置成功'
);
}
};
setTimeout
(
retrySetWebviewStyle
,
100
);
};
};
// 处理课程详情
// 处理课程详情
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment