vue从路径中获取参数

created() {
    if (this.$route.params && this.$route.params.id) {
      // vue从路径中获取参数 此处参数名为id
      const id = this.$route.params.id
      this.fetchDataById(id)
    }
  }
posted @ 2020-11-16 16:25  yx袁祥  阅读(4088)  评论(0)    收藏  举报