feat: 增加复制路径功能 (#749)

Co-authored-by: blank <admin@zym88.cn>
This commit is contained in:
你的明明呐丶 2023-04-24 18:21:44 +08:00 committed by GitHub
parent 9435290bb6
commit bfd857ec4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 0 deletions

View file

@ -789,6 +789,7 @@ const message = {
theme: 'Theme',
language: 'Language',
eol: 'End Of Line',
copyDir: 'Copy Dir',
},
setting: {
all: 'All',

View file

@ -796,6 +796,7 @@ const message = {
theme: '主题',
language: '语言',
eol: '行尾符',
copyDir: '复制路径',
},
setting: {
all: '全部',

View file

@ -297,6 +297,18 @@ const open = async (row: File.File) => {
}
};
const copyDir = (row: File.File) => {
if (row?.path) {
const input = document.createElement('textarea');
input.value = row?.path;
document.body.appendChild(input);
input.select();
document.execCommand('copy');
document.body.removeChild(input);
MsgSuccess('复制成功');
}
};
const handlePath = () => {
if (breadCrumbRef.value.offsetWidth > pathWidth.value) {
paths.value.splice(0, 1);
@ -549,6 +561,10 @@ const buttons = [
label: i18n.global.t('file.open'),
click: open,
},
{
label: i18n.global.t('file.copyDir'),
click: copyDir,
},
{
label: i18n.global.t('file.mode'),
click: openMode,