简明uniapp教程uin-app uniApp

web-view加载网络html页面的实现及问题

2020-01-06  本文已影响0人  瑟闻风倾

1. web-view加载网络html页面

<template>
    <view>
        <web-view :src="url" @message="getMessage"></web-view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                url: 'https://uniapp.dcloud.io/static/web-view.html'
            }
        },
        onLoad(options) {
            if (options && options.url) {
                this.url = options.url;
            }
        },
        methods: {
            getMessage(event) {
                uni.showModal({
                    content: JSON.stringify(event.detail),
                    showCancel: false
                });
            }
        }
    }
</script>

<style>

</style>

2. 报错问题 -(X-Frame-Options 响应头)

上一篇 下一篇

猜你喜欢

热点阅读