Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
feat: update basic-form demo
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Mar 16, 2022
1 parent a43353d commit 27f95ec
Show file tree
Hide file tree
Showing 26 changed files with 1,071 additions and 446 deletions.
28 changes: 28 additions & 0 deletions mock/demo/select-demo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { MockMethod } from 'vite-plugin-mock';
import { resultSuccess } from '../_util';

const demoList = (keyword, count = 20) => {
const result = {
list: [] as any[],
};
for (let index = 0; index < count; index++) {
result.list.push({
name: `${keyword ?? ''}选项${index}`,
id: `${index}`,
});
}
return result;
};

export default [
{
url: '/mock-api/select/getDemoOptions',
timeout: 1000,
method: 'get',
response: ({ query }) => {
const { keyword, count } = query;
console.log(keyword);
return resultSuccess(demoList(keyword, count));
},
},
] as MockMethod[];
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@
"vue": "^3.2.31",
"vue-i18n": "9.2.0-beta.30",
"vue-router": "^4.0.14",
"xlsx": "^0.18.3"
"vue-types": "^4.1.1",
"xlsx": "^0.18.4"
},
"devDependencies": {
"@commitlint/cli": "^16.2.1",
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"@types/lodash-es": "^4.17.6",
"@types/node": "^17.0.21",
Expand All @@ -68,10 +69,10 @@
"eslint-plugin-vue": "^8.5.0",
"husky": "^7.0.4",
"less": "^4.1.2",
"lint-staged": "^12.3.5",
"lint-staged": "^12.3.6",
"mockjs": "^1.1.0",
"postcss-html": "^1.3.0",
"prettier": "^2.5.1",
"prettier": "^2.6.0",
"stylelint": "^14.5.3",
"stylelint-config-html": "^1.0.0",
"stylelint-config-prettier": "^9.0.3",
Expand Down
66 changes: 42 additions & 24 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions src/api/demos/select.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { request } from '@/utils/request';

/**
* @description Get sample options value
*/
export function optionsListApi(params?: any) {
return request<{ list: { id: string; name: string }[] }>(
{
url: '/select/getDemoOptions',
method: 'get',
params,
},
{
isMock: true,
isGetDataDirectly: true,
},
);
}
1 change: 1 addition & 0 deletions src/components/core/dynamic-table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export { DynamicTable };
export * from './src/types/';
export * from './src/hooks/';
export * from './src/dynamic-table';
export * from './src/components/';

export type DynamicTableRef = Ref<DynamicTableInstance>;
3 changes: 1 addition & 2 deletions src/components/core/dynamic-table/src/hooks/useTableForm.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { unref, computed, watchEffect } from 'vue';
import { omit } from 'lodash-es';
import type { TableMethods } from './useTableMethods';
import type { TableState } from './useTableState';
import type { ComputedRef, Slots } from 'vue';
Expand Down Expand Up @@ -49,7 +48,7 @@ export function useTableForm({ tableState, slots, tableMethods }: UseTableFormCo
});

// 同步外部对props的修改
watchEffect(() => getQueryFormRef()?.setSchemaFormProps(omit(unref(getFormProps), 'schemas')), {
watchEffect(() => getQueryFormRef()?.setSchemaFormProps(unref(getFormProps)), {
flush: 'post',
});

Expand Down
6 changes: 2 additions & 4 deletions src/components/core/schema-form/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// export { default as SchemaForm } from './schema-form.vue'
import SchemaForm from './src/schema-form.vue';

export * from './src/types/form';
export * from './src/types/formItem';
export * from './src/types/';
export * from './src/schema-form';

export * from './src/hooks/';
export * from './src/components/';

export { SchemaForm };

Expand Down

0 comments on commit 27f95ec

Please sign in to comment.