@@ -37,15 +37,13 @@
diff --git a/src/i18n/zh/common/button.ts b/src/i18n/zh/common/button.ts
index ad177047..2d54a0e5 100644
--- a/src/i18n/zh/common/button.ts
+++ b/src/i18n/zh/common/button.ts
@@ -15,5 +15,6 @@ export default {
profile: '个人信息',
console: '控制台',
learn: '学习',
- buy: '购买'
+ buy: '购买',
+ try: '测试'
};
diff --git a/src/operators/api/models.ts b/src/operators/api/models.ts
index 594f889c..6b0f0e4f 100644
--- a/src/operators/api/models.ts
+++ b/src/operators/api/models.ts
@@ -1,3 +1,15 @@
+export interface IForm {
+ queries?: {
+ [key: string]: string;
+ };
+ headers?: {
+ [key: string]: string;
+ };
+ body?: {
+ [key: string]: string | object | number | object[];
+ };
+}
+
export interface ISchema {
properties: {
[key: string]: ISchema;
diff --git a/src/pages/document/Detail.vue b/src/pages/document/Detail.vue
index 8fd1a853..0607d4a7 100644
--- a/src/pages/document/Detail.vue
+++ b/src/pages/document/Detail.vue
@@ -4,11 +4,11 @@
-
+
@@ -19,6 +19,14 @@ import { defineComponent } from 'vue';
import ApiList from '@/components/document/ApiList.vue';
import ApiUsage from '@/components/document/ApiUsage.vue';
import ApiTry from '@/components/document/ApiTry.vue';
+import { apiOperator } from '@/operators/api/operator';
+import { IApi, IApiDetailResponse, IForm } from '@/operators/api/models';
+
+export interface IData {
+ api: IApi | undefined;
+ loading: boolean;
+ form: IForm;
+}
export default defineComponent({
components: {
@@ -26,9 +34,11 @@ export default defineComponent({
ApiUsage,
ApiTry
},
- data() {
+ data(): IData {
return {
- apiKey: ''
+ api: undefined,
+ loading: false,
+ form: {}
};
},
computed: {
@@ -36,7 +46,32 @@ export default defineComponent({
return this.$route.params.id.toString();
}
},
- methods: {}
+ watch: {
+ id: {
+ handler() {
+ this.getApi(this.id);
+ }
+ }
+ },
+ mounted() {
+ this.getApi(this.id);
+ },
+ methods: {
+ getApi(id: string) {
+ this.loading = true;
+ apiOperator
+ .get(id)
+ .then(({ data: data }: { data: IApiDetailResponse }) => {
+ this.loading = false;
+ this.api = data;
+ console.log('api', this.api);
+ })
+ .catch((error) => {
+ this.loading = false;
+ console.error(error);
+ });
+ }
+ }
});