将数据传递给模态/WebView
Passing Data to modal / WebView
在 NativeScript-Vue 中,将数据传递到模式的简单、干净的方法是什么?
背景:
我需要以模式显示外部网页。 WebView 似乎就是这样。除了 docs 表示您必须对源代码进行硬编码:
<WebView src="http://nativescript-vue.org/" />
那可不行。我需要类似
的东西
<WebView :src="myUrl" />
data() {
return {
myUrl: "https://en.wikipedia.org/wiki/Mary,_Queen_of_Scots",
}
不管文档怎么说,这似乎都有效。耶!!
现在,在模式中,如何将 myUrl
设置为原始应用程序页面中的值?
来自您的原始页面:
this.$showModal(YourWebModal, {
props: {
myUrl: 'https://en.wikipedia.org/wiki/Mary,_Queen_of_Scots'
}
})
在你的模式中:
<WebView :src="myUrl" />
props: ['myUrl'],
data () {
return {}
}
在 NativeScript-Vue 中,将数据传递到模式的简单、干净的方法是什么?
背景: 我需要以模式显示外部网页。 WebView 似乎就是这样。除了 docs 表示您必须对源代码进行硬编码:
<WebView src="http://nativescript-vue.org/" />
那可不行。我需要类似
的东西<WebView :src="myUrl" />
data() {
return {
myUrl: "https://en.wikipedia.org/wiki/Mary,_Queen_of_Scots",
}
不管文档怎么说,这似乎都有效。耶!!
现在,在模式中,如何将 myUrl
设置为原始应用程序页面中的值?
来自您的原始页面:
this.$showModal(YourWebModal, {
props: {
myUrl: 'https://en.wikipedia.org/wiki/Mary,_Queen_of_Scots'
}
})
在你的模式中:
<WebView :src="myUrl" />
props: ['myUrl'],
data () {
return {}
}