Javascript 无法显示注册页vue.js
当按下“转到注册”按钮时,我无法转到注册页面,我已附上下面的代码片段 注册.vueJavascript 无法显示注册页vue.js,javascript,vue.js,vue-router,Javascript,Vue.js,Vue Router,当按下“转到注册”按钮时,我无法转到注册页面,我已附上下面的代码片段 注册.vue <template> <v-app id="inspire"> <v-content> <v-container fluid fill-height > <v-layout align-center justify-center
<template>
<v-app id="inspire">
<v-content>
<v-container
fluid
fill-height
>
<v-layout
align-center
justify-center
>
<v-flex
xs12
sm8
md4
>
<v-card class="elevation-12">
<v-toolbar
color="primary"
dark
flat
>
<v-toolbar-title>SIGNUP FORM</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-card-text>
<v-form>
<v-text-field
label="Email"
name="email"
type="text"
></v-text-field>
<v-text-field
id="password"
label="Password"
name="password"
type="password"
></v-text-field>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary">SIGN UP</v-btn>
</v-card-actions>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-content>
</v-app>
</template>
<template>
<v-app>
<v-content>
<v-btn :to="{ name:'signup'}">GOTO SIGNUP</v-btn>
</v-content>
</v-app>
</template>
<script>
export default {
name: 'App',
components: {
},
data: () => ({
//
}),
};
</script>
App.vue
<template>
<v-app id="inspire">
<v-content>
<v-container
fluid
fill-height
>
<v-layout
align-center
justify-center
>
<v-flex
xs12
sm8
md4
>
<v-card class="elevation-12">
<v-toolbar
color="primary"
dark
flat
>
<v-toolbar-title>SIGNUP FORM</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-card-text>
<v-form>
<v-text-field
label="Email"
name="email"
type="text"
></v-text-field>
<v-text-field
id="password"
label="Password"
name="password"
type="password"
></v-text-field>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary">SIGN UP</v-btn>
</v-card-actions>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-content>
</v-app>
</template>
<template>
<v-app>
<v-content>
<v-btn :to="{ name:'signup'}">GOTO SIGNUP</v-btn>
</v-content>
</v-app>
</template>
<script>
export default {
name: 'App',
components: {
},
data: () => ({
//
}),
};
</script>
转到注册
导出默认值{
名称:“应用程序”,
组成部分:{
},
数据:()=>({
//
}),
};
当我执行此代码时,控制台中没有错误,所有内容都正确编译,我可以看到“GOTO SIGNUP”按钮,但当我单击它时,什么都不会发生,没有错误,什么都不会发生,请您帮助我重新路由到注册页面,我正在使用FeatherJS、vue.js和vuetify。任何帮助都将不胜感激。非常感谢。如果App.vue是您定义主vue实例的地方,则需要将路由器添加到其中:
<script>
import 'router' from 'router.js'
export default {
name: 'App',
router,
components: {
},
data: () => ({
//
}),
};
</script>
从“router.js”导入“router”
导出默认值{
名称:“应用程序”,
路由器,
组成部分:{
},
数据:()=>({
//
}),
};
此外,您还需要添加
元素,以便Vue知道在何处渲染路由组件
<template>
<v-app>
<v-content>
<v-btn :to="{ name:'signup'}">GOTO SIGNUP</v-btn>
<router-view></router-view>
</v-content>
</v-app>
</template>
转到注册
如果App.vue是定义主vue实例的位置,则需要将路由器添加到其中:
<script>
import 'router' from 'router.js'
export default {
name: 'App',
router,
components: {
},
data: () => ({
//
}),
};
</script>
从“router.js”导入“router”
导出默认值{
名称:“应用程序”,
路由器,
组成部分:{
},
数据:()=>({
//
}),
};
此外,您还需要添加
元素,以便Vue知道在何处渲染路由组件
<template>
<v-app>
<v-content>
<v-btn :to="{ name:'signup'}">GOTO SIGNUP</v-btn>
<router-view></router-view>
</v-content>
</v-app>
</template>
转到注册
您应该更新答案,以包括添加路由器视图的示例。我正在删除我的答案,因为您的答案在启用vue-router方面至关重要。您应该更新答案,以包括添加路由器视图的示例。我将删除我的答案,因为您的答案在启用vue路由器方面至关重要。