Skip to content

Commit 78b3407

Browse files
committed
更新[chavy.box.js]: 导入会话时, 可以从粘贴板读取数据
1 parent 7605153 commit 78b3407

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎chavy.box.js‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,12 @@ function printHtml(data, curapp = null) {
498498
</v-card-title>
499499
<v-divider></v-divider>
500500
<v-card-text>
501-
<v-textarea clearable autofocus auto-grow v-model="ui.impSessionDialog.impval" label="会话数据 (JSON)" hint="请粘贴 JSON 格式的会话数据! 你可以通过 复制会话 获得数据."></v-textarea>
501+
<v-textarea clearable auto-grow v-model="ui.impSessionDialog.impval" label="会话数据 (JSON)" hint="请粘贴 JSON 格式的会话数据! 你可以通过 复制会话 获得数据."></v-textarea>
502502
</v-card-text>
503503
<v-divider></v-divider>
504504
<v-card-actions>
505+
<v-btn text @click="" v-clipboard:copy="JSON.stringify(ui.impSessionDialog.impval)" v-clipboard:success="onCopy">复制</v-btn>
506+
<v-btn text @click="onImpSessionPaste">粘粘</v-btn>
505507
<v-spacer></v-spacer>
506508
<v-btn text color="grey darken-1" text @click="ui.impSessionDialog.show = false">取消</v-btn>
507509
<v-btn text color="success darken-1" text @click="onImpSession">导入</v-btn>
@@ -602,6 +604,12 @@ function printHtml(data, curapp = null) {
602604
onSaveSettings() {
603605
axios.post('/api', JSON.stringify({ cmd: 'saveSettings', val: this.ui.curapp.settings }))
604606
},
607+
onImpSessionPaste() {
608+
navigator.clipboard.readText().then((text) => {
609+
this.ui.impSessionDialog.impval = ''
610+
this.ui.impSessionDialog.impval = text
611+
});
612+
},
605613
onImpSession() {
606614
const impjson = this.ui.impSessionDialog.impval
607615
const impSession = impjson && JSON.parse(impjson)

0 commit comments

Comments
 (0)