NativeScript Vue无法导入组件

时间:2020-07-29 00:53:07

标签: javascript vue.js nativescript-vue

我不熟悉使用NativeScript并尝试使用它构建我的第一个程序。我正在尝试将标头组件导入我的主应用程序。当我运行ios模拟器时,看不到标题。

我有我的App组件:

<template>
  <Page>
    <Header :numCorrect="numCorrect" :numTotal="numTotal" />
    <GridLayout columns="*" rows="*">
      <Label class="message" :text="msg" col="0" row="0" />
    </GridLayout>
  </Page>
</template>

<script >
import Header from "./Header.vue";

export default {
  components: {
    Header
  },
  data() {
    return {
      msg: "click me",
      questions: [],
      index: 0,
      numCorrect: 0,
      numTotal: 0
    };
  }
};
</script>

<style scoped>
.message {
  vertical-align: center;
  text-align: center;
  font-size: 20;
  color: #333333;
}
</style>

和我的Header组件:

<template>
  <StackLayout class="nav" orientation="vertical">
    <span class="title">Quiz App</span>
    <span class="title">Counter : 0/0</span>
  </StackLayout>
</template>

<script>
export default {
  name: "Header",
  props: ["numCorrect", "numTotal"]
};
</script>

<style scoped>
nav {
  background-color: red;
  color: #ffffff;
}
</style>

我觉得我已经尽一切努力来显示标题,但仍然没有运气。我是否缺少明显的东西?还是NativeScript的新手。

1 个答案:

答案 0 :(得分:0)

欢迎来到nativescript-vue社区。您的Header组件不包含要显示的有效nativescript元素。将您的physical_devices = tf.config.list_physical_devices('GPU') # 8 GPUs in my setup tf.config.set_visible_devices(physical_devices[0:8], 'GPU') # Using all GPUs (default behaviour) strategy = tf.distribute.experimental.MultiWorkerMirroredStrategy() BATCH_SIZE_PER_REPLICA = 1024 GLOBAL_BATCH_SIZE = BATCH_SIZE_PER_REPLICA * strategy.num_replicas_in_sync train_batches = train_dataset.batch(GLOBAL_BATCH_SIZE) with strategy.scope(): model = build_model_() model.compile(loss = 'binary_crossentropy', optimizer = 'adam', metrics = ['accuracy']) history = model.fit( x = train_batches, epochs=10, verbose = 1, ) 标签替换为<span>标签:

<Label>

如果要将道具包括在柜台中,可以执行以下操作:

<template>
  <StackLayout class="nav" orientation="vertical">
    <Label text="Quiz App" />
    <Label text="Counter : 0/0" />
  </StackLayout>
</template>