-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: search and copy * feat: func bar 1. search 2. copy 3. download * feat: func bar in logs * fix: some details * feat: add icons * fix: hide bar * refactor: template
- Loading branch information
Showing
12 changed files
with
217 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<template> | ||
<div class="w-full flex gap-5 justify-between"> | ||
<SLSearch @input="input" class="max-w-[400px]" /> | ||
<div class="flex gap-3"> | ||
<SLButton hollow @click="copy"> | ||
<SLIcon icon="copy" class="icon"></SLIcon> | ||
{{ $t('experiment.func-bar.copy') }} | ||
</SLButton> | ||
<SLButton hollow @click="download"> | ||
<SLIcon icon="download" class="icon"></SLIcon> | ||
{{ $t('experiment.func-bar.download') }} | ||
</SLButton> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
/** | ||
* @description: 功能条:搜索、复制、下载 | ||
* @file: FuncBar.vue | ||
* @since: 2024-01-10 12:54:19 | ||
**/ | ||
import SLSearch from '@swanlab-vue/components/SLSearch.vue' | ||
import { message } from '@swanlab-vue/components/message' | ||
import { t } from '@swanlab-vue/i18n' | ||
import { copyTextToClipboard, downloadStringAsFile } from '@swanlab-vue/utils/browser' | ||
const props = defineProps({ | ||
// 复制、下载的内容 | ||
content: { | ||
type: String, | ||
default: '' | ||
}, | ||
// 下载时使用的文件名 | ||
filename: { | ||
type: String, | ||
default: 'swanlab.file' | ||
} | ||
}) | ||
const emits = defineEmits(['input', 'download']) | ||
// 输入触发 | ||
const input = (value) => { | ||
emits('input', value) | ||
} | ||
// 复制 | ||
const copy = () => { | ||
copyTextToClipboard(props.content) | ||
message.success(t('experiment.func-bar.copy-success')) | ||
} | ||
// 下载 | ||
const download = () => { | ||
downloadStringAsFile(props.content, props.filename) | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
button { | ||
@apply rounded-lg px-3 py-1 flex items-center gap-2; | ||
} | ||
.icon { | ||
@apply w-4 h-4; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters