Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Commit ca1d876

Browse files
committed
修修补补
修修补补
1 parent 6cf7516 commit ca1d876

File tree

6 files changed

+10
-41
lines changed

6 files changed

+10
-41
lines changed

src/components/Detail.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@
1818
<div class="content" v-if="item != 'images' && item != 'thumbnail' && !editState">
1919
{{ controlData.data[controlData.detaiIndex]![item] }}
2020
</div>
21-
<img v-else-if="item != 'thumbnail' && !editState" :src="controlData.data[controlData.detaiIndex]?.images[0]"
21+
<img v-else-if="item != 'thumbnail' && !editState"
22+
:src="controlData.data[controlData.detaiIndex]?.images[0]"
2223
:alt="controlData.data[controlData.detaiIndex]?.title">
2324
</el-descriptions-item>
2425
</el-descriptions>
2526
</el-drawer>
2627
</template>
2728

2829
<script setup lang="ts">
29-
import { computed, ref } from 'vue'
30+
import { ref } from 'vue'
3031
import { ElButton, ElDrawer } from 'element-plus'
3132
import { useControlData } from '@/stores/useControlData';
3233
@@ -48,7 +49,7 @@ const saveNewVal = () => {
4849
for (let i = 0; i < domArr.length; i++)
4950
controlData.editItem(i, (domArr[i] as HTMLInputElement).value)
5051
console.log(controlData);
51-
52+
5253
changeEditState()
5354
}
5455
</script>

src/components/Table.vue

+4-5
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,15 @@ const js = await res.json();
3131

3232
<script setup lang='ts'>
3333
import DeleteBut from './DeleteBut.vue'
34-
import { ref, reactive, computed } from 'vue'
34+
import { ref, computed } from 'vue'
3535
import { useControlData } from '@/stores/useControlData';
3636
37-
38-
let json = ref(js)
3937
let currentPage = ref(1)
4038
4139
const controlData = useControlData()
42-
controlData.setNewVal(json.value.products)
43-
json.value = js.products
40+
controlData.setNewVal(js.products)
41+
42+
let json = ref(controlData.data)
4443
4544
controlData.$subscribe((mutation, state) => {
4645
json.value = controlData.data

src/main.ts

-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,4 @@ APP.use(router);
1616
APP.use(ElementPlus);
1717
APP.use(pinia);
1818

19-
const whiteList = ['/'];
20-
2119
APP.mount('#app');

src/shims-vue.d.ts

-8
This file was deleted.

src/stores/useControlData.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ref, computed } from 'vue';
1+
import { ref } from 'vue';
22
import { defineStore } from 'pinia';
33

44
interface Data {

src/views/StudentsData.vue

+1-22
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,13 @@
22
<div class="body">
33
<div class="title">title</div>
44
<Table></Table>
5-
<Detail :visible="show" :data="data"></Detail>
5+
<Detail></Detail>
66
</div>
77
</template>
88

99
<script lang="ts" setup>
10-
import { ref, reactive, toRefs } from 'vue'
11-
import { useControlData } from '@/stores/useControlData';
1210
import Table from '@/components/Table.vue';
1311
import Detail from '@/components/Detail.vue';
14-
15-
const controlData = useControlData()
16-
17-
interface Data {
18-
id: number;
19-
title: string;
20-
description: string;
21-
price: number;
22-
discountPercentage: number;
23-
rating: number;
24-
stock: number;
25-
brand: string;
26-
category: string;
27-
thumbnail: string;
28-
images: string[];
29-
}
30-
31-
let data: Data
32-
let show = ref(false)
3312
</script>
3413

3514

0 commit comments

Comments
 (0)