<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link> |
<router-link to="/login">Login</router-link> |
<router-link to="/register">Register</router-link>|
<router-link to="/mirror">Mirror</router-link>
<br /><br />
<button @click="replaceFn">替换当前页面到Mirror(无历史记录)</button><br /><br />
<button @click="goPrev">上一页</button>
<button @click="goNext">下一页</button>
<button @click="refresh">刷新</button>
</div>
<router-view />
</div>
</template>
<script>
export default {
name: "App",
methods: {
replaceFn() {
this.$router.replace("/register");
},
goNext() {
this.$router.go(1);
},
goPrev() {
this.$router.go(-1);
},
refresh(){
this.$router.go(0);
}
},
};
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
}
#nav a {
font-weight: bold;
color: #2c3e50;
}
#nav a.router-link-exact-active {
color: #42b983;
}
</style>