vue href链接拼接
:href="[category.module+'/'+category.id]"<template><ul><!--分类列表--><li v-for="category in results" :key="category-list"&am
·
:href="[category.module+'/'+category.id]"
<template>
<ul>
<!--分类列表-->
<li v-for="category in results" :key="category-list">
<a :href="[category.module+'/'+category.id]">{{ category.title }} </a>
<ul v-if="category.children != ''">
<li v-for="child in category.children" :key="child-list">
<a :href="[child.module+'/'+child.id]">{{ child.title }} </a>
</li>
</ul>
</li>
</ul>
</template>
<script>
export default {
data () {
return {
results: []
}
},
mounted() {
var that = this
axios.get('/api/categories')
.then(function (response) {
that.results = response.data.data
console.log(that.results)
});
}
}
</script>
更多推荐
已为社区贡献4条内容
所有评论(0)