【发布时间】:2019-10-16 18:11:29
【问题描述】:
如何在 nativescript-vue 中使用 $navigationTo 使用 typescript?我在这里完成了这项工作:https://github.com/Figur8/NativescriptLoginTestVue, 但是当我尝试使用打字稿时,我得到了这个错误。 [Vue 警告]:未知的自定义元素:- 您是否正确注册了组件?对于递归组件,请确保提供“名称”选项。
<template>
<Page>
<FlexboxLayout class="page">
<StackLayout class="form">
<Image
src="https://www.carnegietechnologies.com/sites/ct/assets/image/logo-octopus.png"
loadMode="async" stretch="aspectFit"></Image>
<StackLayout class="input-field">
<TextField v-model="email" hint="email" class="input" keyboardType="email"
autocorrect="false" autocapitalizationType="none" >
</TextField>
<Label class="message" :text="email"/>
</StackLayout>
<StackLayout class="input-field">
<TextField hint="Password" secure="true" class="input">
</TextField>
</StackLayout>
<Button text="Log In" class="btn btn-primary" @tap="clientLogin" ></Button>
<Button text="Log In" class="btn btn-primary"
@tap="$goTo"></Button>
</StackLayout>
</FlexboxLayout>
</Page>
</template>
<script lang="ts">
import Vue from 'nativescript-vue';
import {Component} from 'vue-property-decorator';
import Home from "./Home";
@Component
export default class App extends Vue {
goTo(){
this.$navigateTo(Home);
}
}
</script>
<style scoped>
ActionBar {
background-color: #53ba82;
color: #ffffff;
}
.message {
vertical-align: center;
text-align: center;
font-size: 20;
color: #333333;
}
</style>
【问题讨论】:
标签: typescript nativescript nativescript-vue