web-view-local.uvue 886 字节
Newer Older
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
1
<template>
2 3 4 5 6
  <view class="uni-flex-item">
    <web-view ref="web-view" class="uni-flex-item" src="/hybrid/html/local.html" @message="message" @error="error"
      @loading="loading" @loaded="loaded">
    </web-view>
  </view>
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
7 8 9
</template>

<script>
10 11 12 13 14 15 16 17
  export default {
    data() {
      return {
      }
    },
    methods: {
      message(event : WebViewMessageEvent) {
        console.log(JSON.stringify(event.detail));
W
微调  
wanganxp 已提交
18 19 20 21
        uni.showModal({
          content: JSON.stringify(event.detail),
          showCancel: false
        });
22 23 24 25 26 27 28 29 30 31 32 33
      },
      error(event : WebViewErrorEvent) {
        console.log(JSON.stringify(event.detail));
      },
      loading(event : WebViewLoadingEvent) {
        console.log(JSON.stringify(event.type));
      },
      loaded(event : WebViewLoadedEvent) {
        console.log(JSON.stringify(event.type));
      }
    }
  }
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
34 35 36 37
</script>

<style>

W
微调  
wanganxp 已提交
38
</style>