diff --git a/README.md b/README.md index 77f0fd3..332ecb8 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ import 'vue-json-viewer/style.css' | ----------- |:------------- | ----------- | | `value` | JSON data (can be used with `v-model`) | **Required** | | `expand-depth` | Collapse blocs under this depth | `1` | -| `copyable` | Display the copy button | `false` | +| `copyable` | Display the copy button, you can customize copy text just set `{copyText: 'copy', copiedText: 'copied'}` or set `true` use default copytext | `false` | | `sort` | Sort keys before displaying | `false` | | `boxed` | Add a fancy "boxed" style to component | `false` | | `theme` | Add a custom CSS class for theming purposes | `jv-light` | diff --git a/README_CN.md b/README_CN.md index c2eca9f..6fbc4df 100644 --- a/README_CN.md +++ b/README_CN.md @@ -141,7 +141,7 @@ import 'vue-json-viewer/style.css' | ----------- |:------------- | ----------- | | `value` | json对象的值,可以使用v-model,支持响应式 | **必填** | | `expand-depth` | 默认展开的层级 | `1` | -| `copyable` | 展示复制按钮 | `false` | +| `copyable` | 展示复制按钮,默认文案为:copy、copied!, 你可以设置一个对象`{copyText: 'copy', copiedText: 'copied'}` 来自定义复制按钮文案 | `false` | | `sort` | 按照key排序展示 | `false` | | `boxed` | 为组件添加一个盒样式 | `false` | | `theme` | 添加一个自定义的样式class用作主题 | `jv-light` | diff --git a/example/app.js b/example/app.js index 06a95d4..9d639ae 100644 --- a/example/app.js +++ b/example/app.js @@ -13,7 +13,10 @@ new Vue({ diff --git a/lib/json-viewer.vue b/lib/json-viewer.vue index f26a1c2..03cc68b 100644 --- a/lib/json-viewer.vue +++ b/lib/json-viewer.vue @@ -8,7 +8,7 @@ ref="clip" class="jv-button" :class="{copied}" - >{{ copied ? 'copied!' : 'copy' }} + >{{ copied ? copyText.copiedText : copyText.copyText }}