Vue中格式化json數據


Vue中 格式化 json 數據

  • 安裝 vue-json-viewer

    npm install vue-json-viewer --save
    
  • main.js 中配置

    // json格式化顯示
    import JsonViewer from 'vue-json-viewer'
    Vue.use(JsonViewer)
    
  • vue-json-viewer 使用

    <json-viewer :value="props.row.request_args" :expand-depth=4 sort></json-viewer>
    
  • 參數

    屬性 描述 默認值
    value JSON data (can be used with v-model)
    expand-depth Collapse blocs under this depth 1
    copyable Display the copy button, you can customize copy text just set {copyText: 'copy', copiedText: 'copied', timeout: 2000} or set true use default copytext false
    sort Sort keys before displaying false
    boxed Add a fancy "boxed" style to component false


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM