使用vue框架写一个京东网页的商品分类栏
时间: 2023-05-16 17:04:49 浏览: 114
使用Vue开发的京东商城首页
好的,以下是使用 Vue 框架编写京东网页商品分类栏的代码:
<template>
<div class="category">
<ul>
<li v-for="(item, index) in categoryList" :key="index">
<a :href="item.link">{{ item.name }}</a>
</li>
</ul>
</div>
</template>
<script>
export default {
data() {
return {
categoryList: [
{ name: '手机', link: '/category/phone' },
{ name: '电脑', link: '/category/computer' },
{ name: '家电', link: '/category/appliance' },
{ name: '服装', link: '/category/clothing' },
{ name: '美妆', link: '/category/beauty' },
{ name: '母婴', link: '/category/mother' },
{ name: '食品', link: '/category/food' },
{ name: '图书', link: '/category/book' },
{ name: '运动', link: '/category/sport' },
{ name: '汽车', link: '/category/car' }
]
}
}
}
</script>
<style scoped>
.category {
ul {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0;
margin: 0;
list-style: none;
}
li {
margin: 0 10px;
}
a {
color: #333;
text-decoration: none;
}
}
</style>
希望这个代码对你有所帮助!
阅读全文