vue传参二
<template> <ul> <li v-for="(value,key,index) in list" :key="index"> {{value}} </li> <button @click="back">back</button> </ul> </template> <script> export default{ data(){ return { list:{} } }, created(){ this.getData(); }, methods:{ getData(){ this.$http.get('http://localhost:3000/'+this.$route.params.type+'/'+this.$route.params.id).then((res)=>{ this.list = res.data; }) }, back(){ // this.$router.go(-1); this.$router.back(); //返回之前的页面 } } } </script>