|
|
@@ -8,12 +8,32 @@
|
|
|
<van-button type="default">默认按钮</van-button>
|
|
|
<van-button type="danger">危险按钮</van-button>
|
|
|
<van-button type="warning">警告按钮</van-button>
|
|
|
- {{ list }}
|
|
|
+ <!-- {{ list }} -->
|
|
|
+ <!-- 渲染 -->
|
|
|
+ <div class="box">
|
|
|
+ <div class="content" v-for="(item, index) in list" :key="index">
|
|
|
+ <div class="top">
|
|
|
+ <div class="left">{{ item.title }}</div>
|
|
|
+ <div class="right">查看更多</div>
|
|
|
+ </div>
|
|
|
+ <div class="bottom">
|
|
|
+ <van-grid :column-num="3" :border="false">
|
|
|
+ <van-grid-item
|
|
|
+ v-for="(item1, index1) in item.productDtoList"
|
|
|
+ :key="index1"
|
|
|
+ >
|
|
|
+ <van-image :src="item1.pic" />
|
|
|
+ <p>{{ item1.prodName }}</p>
|
|
|
+ </van-grid-item>
|
|
|
+ </van-grid>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import axios from 'axios';
|
|
|
+import axios from "axios";
|
|
|
import { ref, reactive, onMounted } from "vue";
|
|
|
import { useCountStore } from "@/store/count";
|
|
|
import { storeToRefs } from "pinia";
|
|
|
@@ -28,19 +48,35 @@ function changeAdd() {
|
|
|
});
|
|
|
}
|
|
|
let list = ref([]);
|
|
|
-onMounted(()=>{
|
|
|
- init();
|
|
|
-
|
|
|
-})
|
|
|
+onMounted(() => {
|
|
|
+ init();
|
|
|
+});
|
|
|
function init() {
|
|
|
- axios.get("http://shop-api.edu.koobietech.com/prod/tagProdList").then(res => {
|
|
|
- console.log(res.data.data)
|
|
|
- list.value = res.data.data;
|
|
|
- })
|
|
|
+ axios
|
|
|
+ .get("http://shop-api.edu.koobietech.com/prod/tagProdList")
|
|
|
+ .then((res) => {
|
|
|
+ console.log(res.data.data);
|
|
|
+ list.value = res.data.data;
|
|
|
+ });
|
|
|
}
|
|
|
// get
|
|
|
// http://shop-api.edu.koobietech.com/prod/tagProdList
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss" scoped>
|
|
|
+<style scoped>
|
|
|
+.box {
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+.content {
|
|
|
+ border-bottom: 2px solid #ccc;
|
|
|
+ margin-top: 10px;
|
|
|
+ padding: 0 10px;
|
|
|
+}
|
|
|
+.content .top {
|
|
|
+ width: 100%;
|
|
|
+ height: 50px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+}
|
|
|
</style>
|