Skip to content

DataSource

如何使用DataSource ?

ts
// cas认证后,设置全局ajax配置
window.gui.setAjaxConfig({sysCode:"",appType:"",tokenName:"",token:null})
// 单个.vue文件引入
<script setup lang="ts">
  import { DataSource } from 'g-ui-web';
  const ds = DataSource({
    path: "https://viz-ui.gtcloud.cn/web-ui/data.json",
    resPath: "data"
  });
</script>

单个组件使用 DataSource

单个组件使用 DataSource(多个数据源)

多个组件使用 DataSource

DataSource API

名称说明类型默认值
on监听事件event-
load加载数据function-
reload重新加载数据function-

data API

名称说明类型默认值
pathip地址,开发环境配置代理地址,接口地址string
method方法stringget
paramsparamsdata 参数object
resPath接口响应数据 格式如 : 'data/obj/list'string'data'
ContentTypecontent-typestringapplication/json;charset=UTF-8
headers请求头object-
transformResponse格式化数据function-