当前位置:网站首页>uniapp web-view示例(微信小程序)
uniapp web-view示例(微信小程序)
2022-04-22 05:59:00 【周周池】
uniapp web-view示例(微信小程序)
web-view 是一个 web 浏览器组件,可以用来承载网页的容器,会自动铺满整个页面(nvue 使用需要手动指定宽高)。
需求:需要把H5网页嵌套入uniapp开发的微信小程序。
用vuex当做仓库保存web-view路径,跳转到pages/webview/index
navigateToMineDay(url, type) {
if (type == 'webView') {
let myurl_ = appUrl + `/h5/#/pages/Stfj/wxgz_logln/wxgz_login?uid=${
this.UserInfo.id}`
this.$store.dispatch('SUpdatewebViewUrl',myurl_)
setTimeout(() => {
uni.navigateTo({
url: `../webview/index`
})
}, 0)
} else {
uni.navigateTo({
url: `${
url}`
})
}
}
pages/webview/index:
<template>
<view class="Page">
<web-view :src="webViewUrl"></web-view>
</view>
</template>
<script>
import {
mapState
} from "vuex"
export default {
data() {
return {
}
},
computed: {
...mapState({
webViewUrl: state => state.webViewUrl
})
}
}
</script>
<style lang="scss">
</style>
pages.json:
{
"root": "pages/webview",
"pages": [{
"path": "index",
"style": {
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor":"#FFFFFF",
"backgroundColor":"#f7f7f7",
"app-plus": {
"bounce": "none"
}
}
}
]
},
版权声明
本文为[周周池]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_45444562/article/details/122818908
边栏推荐
- 封装微信小程序实时获取经纬度+权限判定+引导授权(无30秒延迟)
- 点击触发其他dom元素:< $refs,$el >
- PostgreSQL uses clickhousedb_ FDW access Clickhouse
- Solve the problem of error in installing PostgreSQL under windows2012 R2
- JS 获取屏幕,浏览器,网页高度宽度
- Cancel password after excel worksheet forgets password
- EXCEL VLOOKUP函数的使用
- Usage rules of cast function in MySQL
- uniapp全局拦截401跳转到登录页
- JS, JQ single line text scrolling up and down
猜你喜欢

从零开始学安卓(kotlin)五——UI

webService接口编写并发布与webService接口的调用(一)

Shumei technology was invited to participate in the content governance label seminar of ICT Institute

Mapping of oid and relfilenode in PostgreSQL

You can't open more than 10 pages in wechat applet. After reaching 10 pages, you can't open a new page

uglifyjs压缩JS

A set of SQL statements supports both Oracle and MySQL?

Excel工作表忘记密码后取消密码

LeetCode 1547:切棍子的最小成本

使用Navicat 备份mysql数据库
随机推荐
创新实训(十一)机票爬取 公司信息
List&lt;Map&gt;复制:浅拷贝与深拷贝
The legal red line of minors that cannot be ignored in America
The difference between equalsignorecase() and equals()
纯js链式动画和同时运动
MySql事务之ACID
js对url进行编码和解码(三种方式区别)
小程序调用扫描二维码功能并跳转到二维码指定的路径
剑指offer:栈的压入、弹出序列
You can't open more than 10 pages in wechat applet. After reaching 10 pages, you can't open a new page
Functions and methods in Scala, function creation, closure and corrilization
How to set the size of a window in a window function
pixel手机救砖教程
每日一题——寻找小于目标数的最大单调递增数
Regular verification
EXCEL IFS函数的使用
MySQL——一条语句的执行流程和原理
Intersection of interval lists
Redis取出数据乱码问题
Escort · the future 𞓜 digital risk control summit of digital America 2022 officially set off