vue-json-viewer
vue-json-viewer copied to clipboard
内容为字符串时复制问题
trafficstars
const clipBoard = new Clipboard(this.$refs.clip, {
container: this.$refs.viewer,
text: () => {
return JSON.stringify(this.value, null, 2)
}
});
value如果是字符串不需要JSON.stringify
const clipBoard = new Clipboard(this.$refs.clip, {
container: this.$refs.viewer,
text: () => {
if (typeof this.value === 'string') {
return this.value;
}
return JSON.stringify(this.value, null, 2)
}
});