vue.js 前端 vue 使用vue-json-viewer 展示 JSON 格式的数据 - this
npm install vue-json-viewer --save
预览
import viewer from './components/viewer.vue'
export default {
components: { viewer },
methods:{ 拼多多帮助力入口
previewClick(){
this.previewVisible = true
let list = [
{
"id": "1",
"amount": 1,
"count": 1,
"label": "a"
},
{
"id": "2",
"amount": 2,
"count": 2,
"label": "b"
},
]
const str = JSON.stringify(list)
this.$nextTick(() => {
this.$refs.viewer.jsonStr = str
})
}
}
}
viewer.vue
文章来源