gpt4 book ai didi

vue-native - 如何在vue-native中制作webview

转载 作者:行者123 更新时间:2023-12-04 01:03:16 32 4
gpt4 key购买 nike

我正在尝试使用 vue-native-cli 制作 webview 应用程序

我正在尝试在 documents 的帮助下使用 WebView 组件

这是我的页面

<template>
<web-view
:source="'https://google.com'"
:style="{marginTop: 20}"
/>
</template>

<script>
export default {
methods: {

}
}
</script>
<style>

</style>

当我使用

<view class="text-container">
<text>Hello World</text>
</view>

它工作正常,但在 webview 中获取

invarian voilation:元素类型无效

最佳答案

似乎 React Native 的某些部分在幕后发生了变化,而 Vue Native 文档尚未更新以解决这个问题。截至 2020 年 3 月的回答:

  1. 通过expo install react-native-webview安装webview组件
  2. 导入你的组件
  3. 确保您的 :source 属性将 uri 作为对象传递:
<template>
<web-view :source="{uri:'https://google.com'}" />
</template>

<script>
import { WebView } from "react-native-webview";

export default {
name: "myComponent",
components: {
"web-view": WebView
}
};
</script>

关于vue-native - 如何在vue-native中制作webview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57736138/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com