File tree 2 files changed +41
-13
lines changed <
8000
/button>2 files changed +41
-13
lines changed Original file line number Diff line number Diff line change 10
10
>
11
11
<n-tab-pane name =" signin" tab =" 编辑" >
12
12
<n-form >
13
- <n-form-item-row label =" 用户名 " >
13
+ <n-form-item-row label =" 接口名称 " >
14
14
<n-input />
15
15
</n-form-item-row >
16
- <n-form-item-row label =" 密码 " >
16
+ <n-form-item-row label =" url " >
17
17
<n-input />
18
18
</n-form-item-row >
19
19
</n-form >
20
- <n-button type =" primary" block secondary strong > 登录 </n-button >
20
+ <n-button type =" primary" block secondary strong > 接口名称 </n-button >
21
21
</n-tab-pane >
22
- <n-tab-pane name =" signup" tab =" 编辑 " >
22
+ <n-tab-pane name =" signup" tab =" 预览 " >
23
23
<n-form >
24
- <n-form-item-row label =" 用户名 " >
24
+ <n-form-item-row label =" 接口名称 " >
25
25
<n-input />
26
26
</n-form-item-row >
27
- <n-form-item-row label =" 密码" >
28
- <n-input />
29
- </n-form-item-row >
30
- <n-form-item-row label =" 重复密码" >
27
+ <n-form-item-row label =" url" >
31
28
<n-input />
32
29
</n-form-item-row >
33
30
</n-form >
38
35
</template >
39
36
40
37
<script setup lang="ts">
38
+ import { ref , onMounted , watch } from ' vue' ;
39
+ import type { tMockItem , tMockProject } from ' ~/electron/utils/mock/types' ;
40
+
41
+ interface Props {
42
+ id: number ;
43
+ project: tMockProject | null ;
44
+ }
45
+ const props = defineProps <Props >();
46
+
47
+ const mockData = ref <tMockItem >();
48
+
49
+ const fetchData = () => {
50
+ const { id, project } = props ;
51
+ const data = project ?.mockList .find ((m : tMockItem ) => m .id === id );
52
+ if (data ) {
53
+ mockData .value = data ;
54
+ }
55
+ };
56
+ watch (
57
+ () => props .project ,
58
+ () => {
59
+ fetchData ();
60
+ }
61
+ );
62
+ onMounted (() => {
63
+ fetchData ();
64
+ });
41
65
</script >
42
66
43
67
<style scoped></style >
Original file line number Diff line number Diff line change 32
32
:mock-list =" project?.mockList || []"
33
33
:base-url =" project?.config?.baseUrl || ''"
34
34
/>
35
- <ApiDetail v-else />
35
+ <ApiDetail v-else :id = " mockId " :project = " project " />
36
36
</n-layout >
37
37
</n-layout >
38
38
</n-layout >
@@ -56,15 +56,16 @@ const { routerPush } = useRouterPush();
56
56
const route = useRoute ();
57
57
const id = Number (route .query ?.id );
58
58
const menuValue = ref (' api-list' );
59
- // eslint-disable-next-line @typescript-eslint/ban-types
60
59
const project = ref <tMockProject | null >(null );
60
+ const mockId = ref (0 );
61
61
62
62
const { iconRender } = useIconRender ();
63
63
64
64
const options = computed <any []>(() => {
65
65
const baseItem = {
66
66
label: ' 全部接口' ,
67
67
key: ' api-list' ,
68
+ id: 0 ,
68
69
icon: iconRender ({ icon: ' vscode-icons:default-folder-opened' })
69
70
};
70
71
const list =
@@ -87,8 +88,11 @@ const fetchData = async () => {
87
88
const handleToProjects = () => {
88
89
routerPush ({ name: routeName (' mock_projects' ) });
89
90
};
90
- const handleUpdateValue = (key : string ) => {
91
+ const handleUpdateValue = (key : string , item : any ) => {
91
92
menuValue .value = key ;
93
+ if (item .id ) {
94
+ mockId .value = item .id ;
95
+ }
92
96
};
93
97
const handleAddMock = async () => {
94
98
try {
@@ -101,7 +105,7 @@ const handleAddMock = async () => {
101
105
createdAt: new Date ().getTime (),
102
106
data: {
103
107
code: 200 ,
104
- msg: ' holle ' ,
108
+ msg: ' test ' ,
105
109
data: {
106
110
' list|1-10' : [
107
111
{
You can’t perform that action at this time.
0 commit comments