<script setup lang="ts">
    const webviewStyles = reactive({
        progress: {
            color: '#FF3333',
        },
    })

    onLoad(() => {
        const pages = getCurrentPages()
        const currentPage = pages[pages.length - 1]
        const webview = currentPage.$getAppWebview()
        webview.addEventListener('loaded', () => {
            webview.appendJsFile('_www/static/uni.webview.1.5.6.js')
            webview.evalJS(`
                document.addEventListener('UniAppJSBridgeReady', function() {
                    uni.getEnv(function(res) {
                        console.log('当前环境：' + JSON.stringify(res));
                    })
                })
            `)
        })
    })
</script>

<template>
    <view>
        <web-view :webview-styles="webviewStyles" src="https://uniapp.dcloud.io/static/web-view.html" />
    </view>
</template>
