Skip to content

Commit

Permalink
fix(tree): tree can customize title close vbenjs#344
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Mar 10, 2021
1 parent a759e44 commit ed422b7
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- 修复页面切换的动画无法关闭
- 修复`PageWrapper`title 不显示
- 修复表格已知问题
- 修复 BasicTree 组件不能自定义 title 问题

## 2.0.3 (2021-03-07)

Expand Down
2 changes: 1 addition & 1 deletion mock/demo/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const userInfo = {

export default [
{
url: '/api/account/getAccountInfo',
url: '/basic-api/account/getAccountInfo',
timeout: 1000,
method: 'get',
response: () => {
Expand Down
2 changes: 1 addition & 1 deletion mock/demo/select-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const demoList = (() => {

export default [
{
url: '/api/select/getDemoOptions',
url: '/basic-api/select/getDemoOptions',
timeout: 4000,
method: 'get',
response: ({ query }) => {
Expand Down
10 changes: 5 additions & 5 deletions mock/demo/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const menuList = (() => {

export default [
{
url: '/api/system/getAccountList',
url: '/basic-api/system/getAccountList',
timeout: 100,
method: 'get',
response: ({ query }) => {
Expand All @@ -116,7 +116,7 @@ export default [
},
},
{
url: '/api/system/getRoleListByPage',
url: '/basic-api/system/getRoleListByPage',
timeout: 100,
method: 'get',
response: ({ query }) => {
Expand All @@ -125,23 +125,23 @@ export default [
},
},
{
url: '/api/system/getAllRoleList',
url: '/basic-api/system/getAllRoleList',
timeout: 100,
method: 'get',
response: () => {
return resultSuccess(roleList);
},
},
{
url: '/api/system/getDeptList',
url: '/basic-api/system/getDeptList',
timeout: 100,
method: 'get',
response: () => {
return resultSuccess(deptList);
},
},
{
url: '/api/system/getMenuList',
url: '/basic-api/system/getMenuList',
timeout: 100,
method: 'get',
response: () => {
Expand Down
2 changes: 1 addition & 1 deletion mock/demo/table-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const demoList = (() => {

export default [
{
url: '/api/table/getDemoList',
url: '/basic-api/table/getDemoList',
timeout: 100,
method: 'get',
response: ({ query }) => {
Expand Down
2 changes: 1 addition & 1 deletion mock/sys/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ const levelRoute = {
};
export default [
{
url: '/api/getMenuListById',
url: '/basic-api/getMenuListById',
timeout: 1000,
method: 'get',
response: ({ query }) => {
Expand Down
6 changes: 3 additions & 3 deletions mock/sys/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand All @@ -65,7 +65,7 @@ export default [
},
},
{
url: '/api/getUserInfoById',
url: '/basic-api/getUserInfoById',
method: 'get',
response: ({ query }) => {
const { userId } = query;
Expand All @@ -77,7 +77,7 @@ export default [
},
},
{
url: '/api/getPermCodeByUserId',
url: '/basic-api/getPermCodeByUserId',
timeout: 200,
method: 'get',
response: ({ query }) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
:popoverVisible="getRuleVisible"
:rule="getRule"
:ruleMessage="ruleMessage"
allowClear
size="small"
ref="elRef"
@change="handleChange"
Expand Down
37 changes: 12 additions & 25 deletions src/components/Tree/src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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 }),
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit ed422b7

Please sign in to comment.