雨悸
雨悸
  • 发布:2021-01-18 10:55
  • 更新:2021-01-18 11:26
  • 阅读:1041

app-nvue 的web-view组件不支持本地网页吗?

分类:uni-app

app-nvue 的web-view组件不支持本地网页吗?

使用web-view组件,页面是app-nvue,设置了宽高样式,网络网页能打开,换成本地网页就打不开了?

2021-01-18 10:55 负责人:无 分享
已邀请:
w***@126.com

w***@126.com - 前端小白菜

支持的,可能是你使用的姿势不对。

  • 雨悸 (作者)

    <template>  
    <view>
    <web-view :style="{width:width+ 'px',height:height+ 'px'}" :src="src" @message="handleMsg"></web-view>
    </view>
    </template>
    <script>
    const host = '/hybrid/html/index.html#'; //新商城--本地
    export default {
    data() {
    return {
    src: '',
    width:uni.getSystemInfoSync().screenWidth,
    height:uni.getSystemInfoSync().screenHeight
    };
    },
    onLoad() {
    this.src = host + '/pages/index/index'
    console.log(this.src);
    },
    methods: {}
    </script>
    <style>
    </style>

    有什么问题吗?换成vue文件就可以打开呢


    2021-01-18 11:12

  • 前端开发者福建

    回复 雨悸: 为何我直接设置200px没效果


    2021-05-18 15:19

雨悸

雨悸 (作者)

<template>  
	<view>  
		<web-view :style="{width:width+ 'px',height:height+ 'px'}" :src="src"  @message="handleMsg"></web-view>  
	</view>  
</template>  
<script>  
	const host = '/hybrid/html/index.html#'; //新商城--本地  
	export default {  
		data() {  
			return {  
				src: '',  
				width:uni.getSystemInfoSync().screenWidth,  
				height:uni.getSystemInfoSync().screenHeight  
			};  
		},  
		onLoad() {  
			this.src = host + '/pages/index/index'  
			console.log(this.src);  
		},  
	      methods: {}  
}  
</script>  
<style>  
</style>
w***@126.com

w***@126.com - 前端小白菜

试试 .html 后面不带东西。

  • 雨悸 (作者)

    /hybrid/html/index.html#/pages/index/index

    /hybrid/html/index.html#

    /hybrid/html/index.html

    奇怪啊,为啥前两个地址就打不开?第三个就能打开。。。。vue页面都能打开


    2021-01-18 11:35

该问题目前已经被锁定, 无法添加新回复