Просмотр исходного кода

fix(tree): tree can customize title close #344

Vben 4 лет назад
Родитель
Сommit
ed422b7c56

+ 2 - 2
.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

+ 1 - 0
CHANGELOG.zh_CN.md

@@ -15,6 +15,7 @@
 - 修复页面切换的动画无法关闭
 - 修复`PageWrapper`title 不显示
 - 修复表格已知问题
+- 修复 BasicTree 组件不能自定义 title 问题
 
 ## 2.0.3 (2021-03-07)
 

+ 1 - 1
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: () => {

+ 1 - 1
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 }) => {

+ 5 - 5
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: () => {

+ 1 - 1
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 }) => {

+ 1 - 1
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 }) => {

+ 3 - 3
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 }) => {

+ 1 - 1
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"
   },

+ 1 - 0
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"

+ 12 - 25
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 && <TreeIcon icon={icon} />}
-                    <span
-                      class={`${prefixCls}__content`}
-                      //  style={unref(getContentStyle)}
-                    >
-                      {get(item, titleField)}
-                    </span>
-                    <span class={`${prefixCls}__actions`}> {renderAction({ ...item, level })}</span>
+                    {slots?.title ? (
+                      getSlot(slots, 'title', item)
+                    ) : (
+                      <>
+                        {icon && <TreeIcon icon={icon} />}
+                        <span class={`${prefixCls}__content`}>{get(item, titleField)}</span>
+                        <span class={`${prefixCls}__actions`}>
+                          {renderAction({ ...item, level })}
+                        </span>
+                      </>
+                    )}
                   </span>
                 ),
                 default: () => renderTreeNode({ data: children, level: level + 1 }),

+ 9 - 9
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: