From ed422b7c56bf9d44be001b8a54358d69c100ff35 Mon Sep 17 00:00:00 2001 From: Vben Date: Thu, 11 Mar 2021 01:22:10 +0800 Subject: [PATCH] fix(tree): tree can customize title close #344 --- .env.development | 4 +- CHANGELOG.zh_CN.md | 1 + mock/demo/account.ts | 2 +- mock/demo/select-demo.ts | 2 +- mock/demo/system.ts | 10 ++--- mock/demo/table-demo.ts | 2 +- mock/sys/menu.ts | 2 +- mock/sys/user.ts | 6 +-- package.json | 2 +- .../src/components/editable/EditableCell.vue | 1 + src/components/Tree/src/index.vue | 37 ++++++------------- yarn.lock | 18 ++++----- 12 files changed, 38 insertions(+), 49 deletions(-) diff --git a/.env.development b/.env.development index a15f7ffe6..d28055585 100644 --- a/.env.development +++ b/.env.development @@ -7,14 +7,14 @@ VITE_USE_MOCK = true VITE_PUBLIC_PATH = / # Cross-domain proxy, you can configure multiple -VITE_PROXY=[["/api","http://localhost:3000"],["/upload","http://localhost:3001/upload"]] +VITE_PROXY=[["/basic-api","http://localhost:3000"],["/upload","http://localhost:3001/upload"]] # VITE_PROXY=[["/api","https://vvbin.cn/test"]] # Delete console VITE_DROP_CONSOLE = false # Basic interface address SPA -VITE_GLOB_API_URL=/api +VITE_GLOB_API_URL=/basic-api # File upload address, optional VITE_GLOB_UPLOAD_URL=/upload diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index 4f31ecc2e..2f01f2de1 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -15,6 +15,7 @@ - 修复页面切换的动画无法关闭 - 修复`PageWrapper`title 不显示 - 修复表格已知问题 +- 修复 BasicTree 组件不能自定义 title 问题 ## 2.0.3 (2021-03-07) diff --git a/mock/demo/account.ts b/mock/demo/account.ts index 45008744f..33c4c1dc5 100644 --- a/mock/demo/account.ts +++ b/mock/demo/account.ts @@ -44,7 +44,7 @@ const userInfo = { export default [ { - url: '/api/account/getAccountInfo', + url: '/basic-api/account/getAccountInfo', timeout: 1000, method: 'get', response: () => { diff --git a/mock/demo/select-demo.ts b/mock/demo/select-demo.ts index a785a1612..da6d462c8 100644 --- a/mock/demo/select-demo.ts +++ b/mock/demo/select-demo.ts @@ -14,7 +14,7 @@ const demoList = (() => { export default [ { - url: '/api/select/getDemoOptions', + url: '/basic-api/select/getDemoOptions', timeout: 4000, method: 'get', response: ({ query }) => { diff --git a/mock/demo/system.ts b/mock/demo/system.ts index 33526f381..67381a75c 100644 --- a/mock/demo/system.ts +++ b/mock/demo/system.ts @@ -107,7 +107,7 @@ const menuList = (() => { export default [ { - url: '/api/system/getAccountList', + url: '/basic-api/system/getAccountList', timeout: 100, method: 'get', response: ({ query }) => { @@ -116,7 +116,7 @@ export default [ }, }, { - url: '/api/system/getRoleListByPage', + url: '/basic-api/system/getRoleListByPage', timeout: 100, method: 'get', response: ({ query }) => { @@ -125,7 +125,7 @@ export default [ }, }, { - url: '/api/system/getAllRoleList', + url: '/basic-api/system/getAllRoleList', timeout: 100, method: 'get', response: () => { @@ -133,7 +133,7 @@ export default [ }, }, { - url: '/api/system/getDeptList', + url: '/basic-api/system/getDeptList', timeout: 100, method: 'get', response: () => { @@ -141,7 +141,7 @@ export default [ }, }, { - url: '/api/system/getMenuList', + url: '/basic-api/system/getMenuList', timeout: 100, method: 'get', response: () => { diff --git a/mock/demo/table-demo.ts b/mock/demo/table-demo.ts index fb04f29c6..856ab6c69 100644 --- a/mock/demo/table-demo.ts +++ b/mock/demo/table-demo.ts @@ -27,7 +27,7 @@ const demoList = (() => { export default [ { - url: '/api/table/getDemoList', + url: '/basic-api/table/getDemoList', timeout: 100, method: 'get', response: ({ query }) => { diff --git a/mock/sys/menu.ts b/mock/sys/menu.ts index 52b61cd2e..e9f07d9ee 100644 --- a/mock/sys/menu.ts +++ b/mock/sys/menu.ts @@ -161,7 +161,7 @@ const levelRoute = { }; export default [ { - url: '/api/getMenuListById', + url: '/basic-api/getMenuListById', timeout: 1000, method: 'get', response: ({ query }) => { diff --git a/mock/sys/user.ts b/mock/sys/user.ts index 318a7b144..a3346c66b 100644 --- a/mock/sys/user.ts +++ b/mock/sys/user.ts @@ -42,7 +42,7 @@ const fakeCodeList: any = { export default [ // mock user login { - url: '/api/login', + url: '/basic-api/login', timeout: 200, method: 'post', response: ({ body }) => { @@ -65,7 +65,7 @@ export default [ }, }, { - url: '/api/getUserInfoById', + url: '/basic-api/getUserInfoById', method: 'get', response: ({ query }) => { const { userId } = query; @@ -77,7 +77,7 @@ export default [ }, }, { - url: '/api/getPermCodeByUserId', + url: '/basic-api/getPermCodeByUserId', timeout: 200, method: 'get', response: ({ query }) => { diff --git a/package.json b/package.json index 89c6ffc29..1ead61473 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "vite-plugin-style-import": "^0.8.1", "vite-plugin-svg-icons": "^0.3.4", "vite-plugin-theme": "^0.4.8", - "vite-plugin-windicss": "0.7.1", + "vite-plugin-windicss": "0.7.2", "vue-eslint-parser": "^7.6.0", "yargs": "^16.2.0" }, diff --git a/src/components/Table/src/components/editable/EditableCell.vue b/src/components/Table/src/components/editable/EditableCell.vue index 39cc47a3e..9cd6e4158 100644 --- a/src/components/Table/src/components/editable/EditableCell.vue +++ b/src/components/Table/src/components/editable/EditableCell.vue @@ -13,6 +13,7 @@ :popoverVisible="getRuleVisible" :rule="getRule" :ruleMessage="ruleMessage" + allowClear size="small" ref="elRef" @change="handleChange" diff --git a/src/components/Tree/src/index.vue b/src/components/Tree/src/index.vue index cfccff696..67fad6e64 100644 --- a/src/components/Tree/src/index.vue +++ b/src/components/Tree/src/index.vue @@ -16,11 +16,10 @@ import { TreeIcon } from './TreeIcon'; import TreeHeader from './TreeHeader.vue'; import { ScrollContainer } from '/@/components/Container'; - // import { DownOutlined } from '@ant-design/icons-vue'; import { omit, get } from 'lodash-es'; import { isBoolean, isFunction } from '/@/utils/is'; - import { extendSlots } from '/@/utils/helper/tsxHelper'; + import { extendSlots, getSlot } from '/@/utils/helper/tsxHelper'; import { filter } from '/@/utils/helper/treeHelper'; import { useTree } from './useTree'; @@ -71,16 +70,6 @@ } ); - // const getContentStyle = computed( - // (): CSSProperties => { - // const { actionList } = props; - // const width = actionList.length * 18; - // return { - // width: `calc(100% - ${width}px)`, - // }; - // } - // ); - const getBindValues = computed(() => { let propsData = { blockNode: true, @@ -106,11 +95,6 @@ emit('update:value', rawVal); }, onRightClick: handleRightClick, - // onSelect: (k, e) => { - // setTimeout(() => { - // emit('select', k, e); - // }, 16); - // }, }; propsData = omit(propsData, 'treeData', 'class'); return propsData; @@ -306,14 +290,17 @@ class={`${prefixCls}-title pl-2`} onClick={handleClickNode.bind(null, item[keyField], item[childrenField])} > - {icon && } - - {get(item, titleField)} - - {renderAction({ ...item, level })} + {slots?.title ? ( + getSlot(slots, 'title', item) + ) : ( + <> + {icon && } + {get(item, titleField)} + + {renderAction({ ...item, level })} + + + )} ), default: () => renderTreeNode({ data: children, level: level + 1 }), diff --git a/yarn.lock b/yarn.lock index e4a27a082..eea5a16c0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1785,10 +1785,10 @@ dependencies: vue-demi latest -"@windicss/plugin-utils@0.7.1": - version "0.7.1" - resolved "https://registry.npmjs.org/@windicss/plugin-utils/-/plugin-utils-0.7.1.tgz#001ba282b78a9d4e110e531d59309d2b9cb0929e" - integrity sha512-ZloIRRKCnArFyDNuhZiFRA15XqhlWaeTcOf3soP9VxWJ+i6/IkH6cnaYgBefDATA/zJodOPsXBnbX333zKVk1Q== +"@windicss/plugin-utils@0.7.2": + version "0.7.2" + resolved "https://registry.npmjs.org/@windicss/plugin-utils/-/plugin-utils-0.7.2.tgz#c43c89a2f51110eb6f49da565dc235fb2af30269" + integrity sha512-4znRERKhhStIOFy1/eB0rJXnXs+NyumBREjh0GZVMoHVmUB9up08tNUpbbq3tlJC96t27VsD4vdfv00T+It/IA== dependencies: esbuild "^0.8.57" esbuild-register "^2.2.0" @@ -9183,12 +9183,12 @@ vite-plugin-theme@^0.4.8: es-module-lexer "^0.3.26" tinycolor2 "^1.4.2" -vite-plugin-windicss@0.7.1: - version "0.7.1" - resolved "https://registry.npmjs.org/vite-plugin-windicss/-/vite-plugin-windicss-0.7.1.tgz#1e1c41c2f62d18a2777819057c981a1ec26d8901" - integrity sha512-0NNrTBgjx11KOwqS/4szfVIt3LURFor4cEEVVJjB8p7JDTnC4K8Cu11bcAvY+QMOfflxv4s2ONo2SU4xkq68kA== +vite-plugin-windicss@0.7.2: + version "0.7.2" + resolved "https://registry.npmjs.org/vite-plugin-windicss/-/vite-plugin-windicss-0.7.2.tgz#1647ee3765edb0f993b81206f35310a63b25c1f9" + integrity sha512-U6N8ljy7meqLkq8aENb3VXKr93Vzp1pU5zwhJr7HmGi+42Wv4i8r7+7BW6WRS4Ght4SAMzFuzIGq9RLPzoZ2Jg== dependencies: - "@windicss/plugin-utils" "0.7.1" + "@windicss/plugin-utils" "0.7.2" windicss "^2.3.0" vite@^2.0.5: