【问题标题】:Vue in nativescript原生脚本中的 Vue
【发布时间】:2020-07-03 09:19:40
【问题描述】:

是否可以在 nativescript vue 中的另一个组件中包含一个组件? 像父子关系

像这样:

<Frame ~mainContent>
    <Page>
        <ActionBar title="Initial Page" style="color:white">
            <NavigationButton icon="res://menu" @tap="openMenu"></NavigationButton>
        </ActionBar>

        <StackLayout>
           <son-component></son-component>
        </StackLayout>
    </Page>
</Frame>

【问题讨论】:

  • 嗨,加布里埃尔——你试过了吗?如果是这样,它会给您带来什么结果?
  • 是的,我试过并得到了这个错误“[TypeError: No known component for element div.]”

标签: nativescript-vue


【解决方案1】:

应该这样做。您需要注册 Son 组件

<Frame ~mainContent>
    <Page>
        <ActionBar title="Initial Page" style="color:white">
            <NavigationButton icon="res://menu" @tap="openMenu"></NavigationButton>
        </ActionBar>

        <StackLayout>
           <Son></Son>
        </StackLayout>
    </Page>
</Frame>

<script >
import Son from "./son-component";

  export default {
    components: {
    Son,
  },
    props: {

  },
  data() {

  }
}
</script>

【讨论】:

    猜你喜欢
    • 2021-01-28
    • 1970-01-01
    • 1970-01-01
    • 2017-10-05
    • 2016-06-08
    • 2023-03-11
    • 1970-01-01
    • 1970-01-01
    • 2017-05-27
    相关资源
    最近更新 更多