2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-06-20 20:00:37 +03:00

feat: support customize copy text

This commit is contained in:
陈峰
2019-08-31 17:15:51 +08:00
parent fae9735acb
commit c0a26557e0
4 changed files with 17 additions and 6 deletions
+11 -3
View File
@@ -8,7 +8,7 @@
ref="clip"
class="jv-button"
:class="{copied}"
>{{ copied ? 'copied!' : 'copy' }}</span>
>{{ copied ? copyText.copiedText : copyText.copyText }}</span>
</div>
<div
class="jv-code"
@@ -54,7 +54,7 @@ export default {
default: 1
},
copyable: {
type: Boolean,
type: [Boolean, Object],
default: false
},
sort: {
@@ -88,8 +88,16 @@ export default {
}
},
computed: {
jvClass () {
jvClass() {
return 'jv-container ' + this.theme + (this.boxed ? ' boxed' : '')
},
copyText() {
const { copyText, copiedText } = this.copyable
return {
copyText: copyText || 'copy',
copiedText: copiedText || 'copied!'
}
}
},
mounted: function () {