前言:本章讲下商品详情页面的一个基本构建。效果图请查看滑到末尾。
Github:https://github.com/Ewall1106/mall(请选择分支chapter25)
1、商品详情页初始化
(1)复制一份test.vue
文件并重命名为goodsDetail
作为我们的商品详情页面
![](https://img.haomeiwen.com/i2891127/fd450f95ee1af959.png)
(2)注册路由
![](https://img.haomeiwen.com/i2891127/b3003cbd056ef4b4.png)
2、结构布局编写
(1)顶部商品轮播图
主要是vue-awesome-swiper
组件库的运用,前面章节vue-awsome-swiper与轮播图组件已经详细讲过,不过多阐述。
![](https://img.haomeiwen.com/i2891127/dca42b11c58adcca.png)
![](https://img.haomeiwen.com/i2891127/ba84c19f975efd4a.png)
(2)价格信息模块
<!-- 价格信息 -->
<div class="product_meta">
<div class="price_meta">
<div class="price">
<span class="price_now">¥399</span>
<span class="discount">¥9999</span>
</div>
<div class="sell_num">已销 9999 件</div>
</div>
<div class="desc">
Candie's女装夏蕾丝气质秋连衣裙新款时尚韩版宽松长裙子仙蕾丝bf长袖气质连衣裙
</div>
</div>
![](https://img.haomeiwen.com/i2891127/26d1f00aa74f0991.png)
- 这里有一个css小技巧说明一下,那就是商品描述要实现这样一个功能:文字只有超过两行才溢出并显示省略号?
![](https://img.haomeiwen.com/i2891127/cda2ecbb5dd5b695.png)
- 更多的一些css小技巧可以看看CSS日常踩坑后的总结
(3)其它
- 商务文案块
- 商品详情图片
- 底部购物栏块
- 顶部导航块
![](https://img.haomeiwen.com/i2891127/c0dc1b36abf01c25.png)
3、这就是我们商品详情页的一个基本结构了
![](https://img.haomeiwen.com/i2891127/0f4cfe13e48b87f9.png)
网友评论