0
点赞
收藏
分享

微信扫一扫

RAC 下Oracle default 用户全部可以locked,包括sysrac

_karen 2023-12-06 阅读 24

若要实现文档 JSON 格式和 Excel 表格的在线预览,你可以使用第三方库来实现。对于文档 JSON 格式,你可以使用 vue-json-pretty 库来展示美观的 JSON 数据;对于 Excel 表格,你可以使用 vue-excel-viewer 库来完成在线预览。下面是一个示例:

 

  1. 在 Vue 组件中导入所需的组件:
import { createApp } from 'vue'
import App from './App.vue'
import VueJsonPretty from 'vue-json-pretty'
import VueExcelViewer from 'vue-excel-viewer'

const app = createApp(App)
app.component('VueJsonPretty', VueJsonPretty)
app.component('VueExcelViewer', VueExcelViewer)
app.mount('#app')

3 在 Vue 模板中,使用 <vue-json-pretty> 组件来展示 JSON 数据,使用 <vue-excel-viewer> 组件来展示 Excel 表格:

<template>
  <div>
    <h2>JSON 数据</h2>
    <vue-json-pretty :data="jsonData"></vue-json-pretty>

    <h2>Excel 表格</h2>
    <vue-excel-viewer :data="excelData"></vue-excel-viewer>
  </div>
</template>

<script setup  lang="ts">

import { defineComponent,ref,reavtive } from 'vue'

      const jsonData = reavtive <any>({
        foo: 'bar',
        baz: [1, 2, 3]
        // 这里是你的 JSON 数据
      })
     const  excelData =ref('path/to/excel.xlsx')  // 这里是你的 Excel 文件路径或 URL
    }
  }
})
</script>

如果你需要加载远程的 Excel 文件,可以使用合适的 URL 替换 excelData 变量的值。

举报

相关推荐

0 条评论