diff --git a/README.md b/README.md index ca692ad..ce290c7 100644 --- a/README.md +++ b/README.md @@ -1 +1,39 @@ -# vue-json-viewer \ No newline at end of file +# vue-json-viewer + +简单json展示工具,基于vue框架开发的展示组件 + +Examples: + +安装: + +``` cli +npm install vue-json-viewer +``` +or +``` cli +yarn add vue-json-viewer +``` + +使用: + +``` js +export default { + name: 'Page', + data() { + return { + jsonData: { + name: [ + {key: 2}, + {key: 'hello word'}, + ], + val: { + b: 'a', + a: 'hello word', + asd2: 1, + asd: false + } + } + } + } +} +``` \ No newline at end of file diff --git a/examples/app.js b/examples/app.js index 00e9cc1..cf90e20 100644 --- a/examples/app.js +++ b/examples/app.js @@ -4,36 +4,21 @@ import './css/ionicons.css'; new Vue({ el: '#app', - render: h => h(JsonViewer, { - domProps: { - id: '123' - }, - props: { - value: { + data() { + return { + jsonData: { name: [ - {name: 2}, - {name: 2}, - {name: 2}, - {name: 2}, - {name: 2}, - {name: 2}, - {name: 2}, - {name: 2}, - {name: 2}, - {name: 2}, - {name: 2}, - {name: 2}, - {name: 2}, + {key: 2}, + {key: 'hello word'}, ], val: { - b: 'a', - a: 'askldjfhlkajshdflhklsdafhkljahsdklfjhlkjsahdflkhaslkjdfhlkashdflkhaslkdhfklashdflkhasljkghlakshdfklhalsjkd', - asd2: 1, - asd: false + b: 'a', + a: 'hello word', + asd2: 1, + asd: false } - }, - showCopy: true, - iconPrefix: 'ion' + } } - }) + }, + components: {JsonViewer} }) \ No newline at end of file diff --git a/examples/index.html b/examples/index.html index 17149a0..5b73870 100644 --- a/examples/index.html +++ b/examples/index.html @@ -7,6 +7,8 @@