Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
5af45275
提交
5af45275
authored
9月 18, 2021
作者:
无木
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: hmr error fixed
修复部分组件可能会造成热更新异常的问题
上级
9c5f11a5
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
128 行增加
和
153 行删除
+128
-153
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+3
-1
Dropdown.vue
src/components/Dropdown/src/Dropdown.vue
+53
-66
IconPicker.vue
src/components/Icon/src/IconPicker.vue
+72
-86
没有找到文件。
CHANGELOG.zh_CN.md
浏览文件 @
5af45275
...
@@ -16,7 +16,9 @@
...
@@ -16,7 +16,9 @@
-
修复点击关闭按钮、最大化按钮旁边的空白区域也会导致
`Modal`
关闭的问题
-
修复点击关闭按钮、最大化按钮旁边的空白区域也会导致
`Modal`
关闭的问题
-
**BasicTree**
修复节点插槽不起作用的问题
-
**BasicTree**
修复节点插槽不起作用的问题
-
**CodeEditor**
修复可能会造成的
`Build`
失败的问题
-
**CodeEditor**
修复可能会造成的
`Build`
失败的问题
-
**其它**
修复多标签在某些情况下关闭页签不会跳转路由的问题
-
**其它**
-
修复多标签在某些情况下关闭页签不会跳转路由的问题
-
修复部分组件可能会造成热更新异常的问题
## 2.7.2(2021-09-14)
## 2.7.2(2021-09-14)
...
...
src/components/Dropdown/src/Dropdown.vue
浏览文件 @
5af45275
<
template
>
<
template
>
<
D
ropdown
:trigger=
"trigger"
v-bind=
"$attrs"
>
<
a-d
ropdown
:trigger=
"trigger"
v-bind=
"$attrs"
>
<span>
<span>
<slot></slot>
<slot></slot>
</span>
</span>
<template
#
overlay
>
<template
#
overlay
>
<
M
enu
:selectedKeys=
"selectedKeys"
>
<
a-m
enu
:selectedKeys=
"selectedKeys"
>
<template
v-for=
"item in dropMenuList"
:key=
"`$
{item.event}`">
<template
v-for=
"item in dropMenuList"
:key=
"`$
{item.event}`">
<
MenuI
tem
<
a-menu-i
tem
v-bind=
"getAttr(item.event)"
v-bind=
"getAttr(item.event)"
@
click=
"handleClickMenu(item)"
@
click=
"handleClickMenu(item)"
:disabled=
"item.disabled"
:disabled=
"item.disabled"
>
>
<
P
opconfirm
<
a-p
opconfirm
v-if=
"popconfirm && item.popConfirm"
v-if=
"popconfirm && item.popConfirm"
v-bind=
"getPopConfirmAttrs(item.popConfirm)"
v-bind=
"getPopConfirmAttrs(item.popConfirm)"
>
>
...
@@ -22,86 +22,73 @@
...
@@ -22,86 +22,73 @@
<Icon
:icon=
"item.icon"
v-if=
"item.icon"
/>
<Icon
:icon=
"item.icon"
v-if=
"item.icon"
/>
<span
class=
"ml-1"
>
{{ item.text }}
</span>
<span
class=
"ml-1"
>
{{ item.text }}
</span>
</div>
</div>
</
P
opconfirm>
</
a-p
opconfirm>
<
template
v-else
>
<
template
v-else
>
<Icon
:icon=
"item.icon"
v-if=
"item.icon"
/>
<Icon
:icon=
"item.icon"
v-if=
"item.icon"
/>
<span
class=
"ml-1"
>
{{
item
.
text
}}
</span>
<span
class=
"ml-1"
>
{{
item
.
text
}}
</span>
</
template
>
</
template
>
</
MenuI
tem>
</
a-menu-i
tem>
<
MenuD
ivider
v-if=
"item.divider"
:key=
"`d-${item.event}`"
/>
<
a-menu-d
ivider
v-if=
"item.divider"
:key=
"`d-${item.event}`"
/>
</template>
</template>
</
M
enu>
</
a-m
enu>
</template>
</template>
</
D
ropdown>
</
a-d
ropdown>
</template>
</template>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
setup
>
import
{
computed
,
PropType
}
from
'vue'
;
import
{
computed
,
PropType
}
from
'vue'
;
import
type
{
DropMenu
}
from
'./typing'
;
import
type
{
DropMenu
}
from
'./typing'
;
import
{
defineComponent
}
from
'vue'
;
import
{
Dropdown
,
Menu
,
Popconfirm
}
from
'ant-design-vue'
;
import
{
Dropdown
,
Menu
,
Popconfirm
}
from
'ant-design-vue'
;
import
{
Icon
}
from
'/@/components/Icon'
;
import
{
Icon
}
from
'/@/components/Icon'
;
import
{
omit
}
from
'lodash-es'
;
import
{
omit
}
from
'lodash-es'
;
import
{
isFunction
}
from
'/@/utils/is'
;
import
{
isFunction
}
from
'/@/utils/is'
;
export
default
defineComponent
({
const
ADropdown
=
Dropdown
;
name
:
'BasicDropdown'
,
const
AMenu
=
Menu
;
components
:
{
const
AMenuItem
=
Menu
.
Item
;
Dropdown
,
const
AMenuDivider
=
Menu
.
Divider
;
Menu
,
const
APopconfirm
=
Popconfirm
;
MenuItem
:
Menu
.
Item
,
MenuDivider
:
Menu
.
Divider
,
const
props
=
defineProps
({
Icon
,
popconfirm
:
Boolean
,
Popconfirm
,
/**
},
* the trigger mode which executes the drop-down action
props
:
{
* @default ['hover']
popconfirm
:
Boolean
,
* @type string[]
/**
*/
* the trigger mode which executes the drop-down action
trigger
:
{
* @default ['hover']
type
:
[
Array
]
as
PropType
<
(
'contextmenu'
|
'click'
|
'hover'
)[]
>
,
* @type string[]
default
:
()
=>
{
*/
return
[
'contextmenu'
];
trigger
:
{
type
:
[
Array
]
as
PropType
<
(
'contextmenu'
|
'click'
|
'hover'
)[]
>
,
default
:
()
=>
{
return
[
'contextmenu'
];
},
},
dropMenuList
:
{
type
:
Array
as
PropType
<
(
DropMenu
&
Recordable
)[]
>
,
default
:
()
=>
[],
},
selectedKeys
:
{
type
:
Array
as
PropType
<
string
[]
>
,
default
:
()
=>
[],
},
},
},
},
emits
:
[
'menuEvent'
],
dropMenuList
:
{
setup
(
props
,
{
emit
})
{
type
:
Array
as
PropType
<
(
DropMenu
&
Recordable
)[]
>
,
function
handleClickMenu
(
item
:
DropMenu
)
{
default
:
()
=>
[],
const
{
event
}
=
item
;
},
const
menu
=
props
.
dropMenuList
.
find
((
item
)
=>
`
${
item
.
event
}
`
===
`
${
event
}
`
);
selectedKeys
:
{
emit
(
'menuEvent'
,
menu
);
type
:
Array
as
PropType
<
string
[]
>
,
item
.
onClick
?.();
default
:
()
=>
[],
}
},
});
const
getPopConfirmAttrs
=
computed
(()
=>
{
const
emit
=
defineEmits
([
'menuEvent'
]);
return
(
attrs
)
=>
{
const
originAttrs
=
omit
(
attrs
,
[
'confirm'
,
'cancel'
,
'icon'
]);
if
(
!
attrs
.
onConfirm
&&
attrs
.
confirm
&&
isFunction
(
attrs
.
confirm
))
originAttrs
[
'onConfirm'
]
=
attrs
.
confirm
;
if
(
!
attrs
.
onCancel
&&
attrs
.
cancel
&&
isFunction
(
attrs
.
cancel
))
originAttrs
[
'onCancel'
]
=
attrs
.
cancel
;
return
originAttrs
;
};
});
return
{
function
handleClickMenu
(
item
:
DropMenu
)
{
handleClickMenu
,
const
{
event
}
=
item
;
getPopConfirmAttrs
,
const
menu
=
props
.
dropMenuList
.
find
((
item
)
=>
`
${
item
.
event
}
`
===
`
${
event
}
`
);
getAttr
:
(
key
:
string
|
number
)
=>
({
key
}),
emit
(
'menuEvent'
,
menu
);
};
item
.
onClick
?.();
},
}
const
getPopConfirmAttrs
=
computed
(()
=>
{
return
(
attrs
)
=>
{
const
originAttrs
=
omit
(
attrs
,
[
'confirm'
,
'cancel'
,
'icon'
]);
if
(
!
attrs
.
onConfirm
&&
attrs
.
confirm
&&
isFunction
(
attrs
.
confirm
))
originAttrs
[
'onConfirm'
]
=
attrs
.
confirm
;
if
(
!
attrs
.
onCancel
&&
attrs
.
cancel
&&
isFunction
(
attrs
.
cancel
))
originAttrs
[
'onCancel'
]
=
attrs
.
cancel
;
return
originAttrs
;
};
});
});
</
script
>
</
script
>
src/components/Icon/src/IconPicker.vue
浏览文件 @
5af45275
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
v-model:value="currentSelect"
v-model:value="currentSelect"
>
>
<template
#
addonAfter
>
<template
#
addonAfter
>
<
P
opover
<
a-p
opover
placement=
"bottomLeft"
placement=
"bottomLeft"
trigger=
"click"
trigger=
"click"
v-model=
"visible"
v-model=
"visible"
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
<div
class=
"flex justify-between"
>
<div
class=
"flex justify-between"
>
<a-input
<a-input
:placeholder=
"t('component.icon.search')"
:placeholder=
"t('component.icon.search')"
@
change=
"
h
andleSearchChange"
@
change=
"
debounceH
andleSearchChange"
allowClear
allowClear
/>
/>
</div>
</div>
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
</ul>
</ul>
</ScrollContainer>
</ScrollContainer>
<div
class=
"flex py-2 items-center justify-center"
v-if=
"getTotal >= pageSize"
>
<div
class=
"flex py-2 items-center justify-center"
v-if=
"getTotal >= pageSize"
>
<
P
agination
<
a-p
agination
showLessItems
showLessItems
size=
"small"
size=
"small"
:pageSize=
"pageSize"
:pageSize=
"pageSize"
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
</div>
</div>
</div>
</div>
<template
v-else
<template
v-else
><div
class=
"p-5"
><
E
mpty
/></div>
><div
class=
"p-5"
><
a-e
mpty
/></div>
</
template
>
</
template
>
</template>
</template>
...
@@ -71,16 +71,14 @@
...
@@ -71,16 +71,14 @@
<SvgIcon
:name=
"currentSelect"
/>
<SvgIcon
:name=
"currentSelect"
/>
</span>
</span>
<Icon
:icon=
"currentSelect || 'ion:apps-outline'"
class=
"cursor-pointer px-2 py-1"
v-else
/>
<Icon
:icon=
"currentSelect || 'ion:apps-outline'"
class=
"cursor-pointer px-2 py-1"
v-else
/>
</
P
opover>
</
a-p
opover>
</template>
</template>
</a-input>
</a-input>
</template>
</template>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
setup
>
import
{
defineComponent
,
ref
,
watchEffect
,
watch
,
unref
}
from
'vue'
;
import
{
ref
,
watchEffect
,
watch
,
unref
}
from
'vue'
;
import
{
useDesign
}
from
'/@/hooks/web/useDesign'
;
import
{
useDesign
}
from
'/@/hooks/web/useDesign'
;
import
{
ScrollContainer
}
from
'/@/components/Container'
;
import
{
ScrollContainer
}
from
'/@/components/Container'
;
import
{
Input
,
Popover
,
Pagination
,
Empty
}
from
'ant-design-vue'
;
import
{
Input
,
Popover
,
Pagination
,
Empty
}
from
'ant-design-vue'
;
import
Icon
from
'./Icon.vue'
;
import
Icon
from
'./Icon.vue'
;
import
SvgIcon
from
'./SvgIcon.vue'
;
import
SvgIcon
from
'./SvgIcon.vue'
;
...
@@ -94,6 +92,12 @@
...
@@ -94,6 +92,12 @@
import
{
useMessage
}
from
'/@/hooks/web/useMessage'
;
import
{
useMessage
}
from
'/@/hooks/web/useMessage'
;
import
svgIcons
from
'virtual:svg-icons-names'
;
import
svgIcons
from
'virtual:svg-icons-names'
;
// 没有使用别名引入,是因为WebStorm当前版本还不能正确识别,会报unused警告
const
AInput
=
Input
;
const
APopover
=
Popover
;
const
APagination
=
Pagination
;
const
AEmpty
=
Empty
;
function
getIcons
()
{
function
getIcons
()
{
const
data
=
iconsData
as
any
;
const
data
=
iconsData
as
any
;
const
prefix
:
string
=
data
?.
prefix
??
''
;
const
prefix
:
string
=
data
?.
prefix
??
''
;
...
@@ -110,88 +114,70 @@
...
@@ -110,88 +114,70 @@
return
svgIcons
.
map
((
icon
)
=>
icon
.
replace
(
'icon-'
,
''
));
return
svgIcons
.
map
((
icon
)
=>
icon
.
replace
(
'icon-'
,
''
));
}
}
export
default
defineComponent
({
const
props
=
defineProps
({
name
:
'IconPicker'
,
value
:
propTypes
.
string
,
components
:
{
[
Input
.
name
]:
Input
,
Icon
,
Popover
,
ScrollContainer
,
Pagination
,
Empty
,
SvgIcon
},
width
:
propTypes
.
string
.
def
(
'100%'
),
inheritAttrs
:
false
,
pageSize
:
propTypes
.
number
.
def
(
140
),
props
:
{
copy
:
propTypes
.
bool
.
def
(
false
),
value
:
propTypes
.
string
,
mode
:
propTypes
.
oneOf
<
(
'svg'
|
'iconify'
)[]
>
([
'svg'
,
'iconify'
]).
def
(
'iconify'
),
width
:
propTypes
.
string
.
def
(
'100%'
),
});
pageSize
:
propTypes
.
number
.
def
(
140
),
copy
:
propTypes
.
bool
.
def
(
false
),
const
emit
=
defineEmits
([
'change'
,
'update:value'
]);
mode
:
propTypes
.
oneOf
<
(
'svg'
|
'iconify'
)[]
>
([
'svg'
,
'iconify'
]).
def
(
'iconify'
),
const
isSvgMode
=
props
.
mode
===
'svg'
;
const
icons
=
isSvgMode
?
getSvgIcons
()
:
getIcons
();
const
currentSelect
=
ref
(
''
);
const
visible
=
ref
(
false
);
const
currentList
=
ref
(
icons
);
const
{
t
}
=
useI18n
();
const
{
prefixCls
}
=
useDesign
(
'icon-picker'
);
const
debounceHandleSearchChange
=
useDebounceFn
(
handleSearchChange
,
100
);
const
{
clipboardRef
,
isSuccessRef
}
=
useCopyToClipboard
(
props
.
value
);
const
{
createMessage
}
=
useMessage
();
const
{
getPaginationList
,
getTotal
,
setCurrentPage
}
=
usePagination
(
currentList
,
props
.
pageSize
,
);
watchEffect
(()
=>
{
currentSelect
.
value
=
props
.
value
;
});
watch
(
()
=>
currentSelect
.
value
,
(
v
)
=>
{
emit
(
'update:value'
,
v
);
return
emit
(
'change'
,
v
);
},
},
emits
:
[
'change'
,
'update:value'
],
);
setup
(
props
,
{
emit
})
{
const
isSvgMode
=
props
.
mode
===
'svg'
;
const
icons
=
isSvgMode
?
getSvgIcons
()
:
getIcons
();
const
currentSelect
=
ref
(
''
);
const
visible
=
ref
(
false
);
const
currentList
=
ref
(
icons
);
const
{
t
}
=
useI18n
();
const
{
prefixCls
}
=
useDesign
(
'icon-picker'
);
const
debounceHandleSearchChange
=
useDebounceFn
(
handleSearchChange
,
100
);
const
{
clipboardRef
,
isSuccessRef
}
=
useCopyToClipboard
(
props
.
value
);
const
{
createMessage
}
=
useMessage
();
const
{
getPaginationList
,
getTotal
,
setCurrentPage
}
=
usePagination
(
currentList
,
props
.
pageSize
,
);
watchEffect
(()
=>
{
currentSelect
.
value
=
props
.
value
;
});
watch
(
()
=>
currentSelect
.
value
,
(
v
)
=>
{
emit
(
'update:value'
,
v
);
return
emit
(
'change'
,
v
);
},
);
function
handlePageChange
(
page
:
number
)
{
setCurrentPage
(
page
);
}
function
handleClick
(
icon
:
string
)
{
function
handlePageChange
(
page
:
number
)
{
currentSelect
.
value
=
icon
;
setCurrentPage
(
page
);
if
(
props
.
copy
)
{
}
clipboardRef
.
value
=
icon
;
if
(
unref
(
isSuccessRef
))
{
createMessage
.
success
(
t
(
'component.icon.copy'
));
}
}
}
function
handleSearchChange
(
e
:
ChangeEvent
)
{
function
handleClick
(
icon
:
string
)
{
const
value
=
e
.
target
.
value
;
currentSelect
.
value
=
icon
;
if
(
!
value
)
{
if
(
props
.
copy
)
{
setCurrentPage
(
1
);
clipboardRef
.
value
=
icon
;
currentList
.
value
=
icons
;
if
(
unref
(
isSuccessRef
))
{
return
;
createMessage
.
success
(
t
(
'component.icon.copy'
));
}
currentList
.
value
=
icons
.
filter
((
item
)
=>
item
.
includes
(
value
));
}
}
}
}
return
{
function
handleSearchChange
(
e
:
ChangeEvent
)
{
t
,
const
value
=
e
.
target
.
value
;
prefixCls
,
if
(
!
value
)
{
visible
,
setCurrentPage
(
1
);
isSvgMode
,
currentList
.
value
=
icons
;
getTotal
,
return
;
getPaginationList
,
}
handlePageChange
,
currentList
.
value
=
icons
.
filter
((
item
)
=>
item
.
includes
(
value
));
handleClick
,
}
currentSelect
,
handleSearchChange
:
debounceHandleSearchChange
,
};
},
});
</
script
>
</
script
>
<
style
lang=
"less"
>
<
style
lang=
"less"
>
@prefix-cls
:
~
'@{namespace}-icon-picker'
;
@prefix-cls
:
~
'@{namespace}-icon-picker'
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论