Skip to content

NativeScript View

由于NativeScript-Vue是在NativeScript之上工作的,因此在某些情况下,有必要从Vue组件创建NativeScripte视图,例如RootLayout和其他场景。

Vue组件不是NativeScript视图,但它可以很容易地生成一个视图createNativeView公用事业。

这个createNativeView该方法允许轻松创建NativeScript视图。例子。

js
import { createNativeView } from "nativescript-vue"
import MyComponent from "./MyComponent.vue"

const node = createNativeView(MyComponent, {
    props: {
      foo: "bar",
      onChange(data){
        // can listen to events launched via `emit`. In this example: `emit("change")`
      }
    }
});
node.mount();
  
const nativeScriptView = node.nativeView;