在设计小程序页面跳转网址时,不可以直接url:'网址',需要用页面跳转,页面<web-view>组件指定网址。
1、更改跳转逻辑:
将url:后的内容更改为页面路径
2、设置页面
新建刚写的页面webView,运用<web-view>组件。如下:
<template>
<view class="webview-page">
<web-view src="http://47.99.113.216" :onLoad="onLoad" />
</view>
</template>
<style scoped>
.webview-page {
width: 100vw;
height: 100vh;
}
</style>
3、验证
成功跳转。