【问题标题】:Nativescript Vue: How to get access to data properties inside of v-template?Nativescript Vue:如何访问 v-template 中的数据属性?
【发布时间】:2019-11-28 22:23:14
【问题描述】:

我可以访问我的数据,例如第一个 Label 元素中的lowText。但是当我在 Pager 组件和 v-template 内部时,我无法访问它。如何在它的上下文中通过?

<StackLayout>
   <Label :text="this.lowText" />
   <Pager for="item in items">
      <v-template>
         <Label :text="this.lowText" />
      </v-template>
   </Pager>
</StackLayout>

【问题讨论】:

    标签: vue.js nativescript nativescript-vue


    【解决方案1】:

    如果lowText 是数据属性,则不必使用this.lowText。只需使用 lowText,它应该在 v-template 的内部和外部都可以工作。

    <StackLayout>
       <Label :text="lowText" />
       <Pager for="item in items">
          <v-template>
             <Label :text="lowText" />
          </v-template>
       </Pager>
    </StackLayout>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-07
      • 2021-02-18
      • 2021-10-01
      • 2019-12-26
      • 2019-01-26
      • 2020-01-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多