data() {
return {
CategoryList: [],
};
},
created() {
// 获取类型列表数据
this.getCategorys();
},
methods: {
async getCategorys() {
try {
// 请求类型列表接口
const response = await apiHttpClient.get('/categorys');
// 设置组件的数据
this.CategoryList = response.data;
} catch (error) {
console.log(error.response);
}
},
},
现在可以拿到 category list ,那怎么取 category/:categoryId 这个数据呢?
说的直接点 怎么可以 url category/1 数据输出到页面上。