vue_路由


<script>
export default {
name: "app01",
data(){
return {
message: '首次敲vue!',
name: "物语",
dream: "小目标",
// isNotYang: false,
isNotYang: true,
user: "林俊杰",
age: 10,
}
},
methods: {
ChangeUsername: function () {
this.name = '相遇'
}
},
created() {
console.log("实例创建后,能获取到this");

// http://localhost:8081/app01?user=li&age=11
// 可获取字符串参数
this.user = this.$route.query.user;
this.age = this.$route.query.age;

// 获取路径参数
this.user = this.$route.params.user;
},
mounted() {
console.log("");
},
}
</script>
posted @ 2020-12-05 22:35  zxy_ang  阅读(79)  评论(0)    收藏  举报