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
名称 | 说明 | 类型 | 默认值 |
---|---|---|---|
path | ip地址,开发环境配置代理地址,接口地址 | string | — |
method | 方法 | string | get |
params | params 、 data 参数 | object | — |
resPath | 接口响应数据 格式如 : 'data/obj/list' | string | 'data' |
ContentType | content-type | string | application/json;charset=UTF-8 |
headers | 请求头 | object | - |
transformResponse | 格式化数据 | function | - |