MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / setData

Function setData

public/iframe/lib/js/commonFun.js:577–593  ·  view source on GitHub ↗
(item, data)

Source from the content-addressed store, hash-verified

575 }
576 },
577 setData(item, data) {
578 // 请求完 根据组件设置的数据绑定方式绑定数据
579 const { dataPath, option, dataConversionFunction, componentsType } = item.property;
580
581 if (!dataConversionFunction) {
582 this.dataBindPath(data, dataPath, item.property, false) // api模式数据不配置叠加模式
583 } else {
584 const func = new Function(`return ${dataConversionFunction}`)()
585 const result = func(data)
586 this.$set(option, 'data', result)
587 }
588 if (componentsType === 'charts') {
589 item.property.option = {...option } // echarts图表没有使用deep watch 因为会导致无限watch造成卡顿 因此这里重新赋值option 触发watch
590 }
591 // this.$set(item, 'isLoading', this.guid())
592
593 },
594 MergeRecursive(obj1, obj2) {
595 // 合并两个数组
596 for (const p in obj2) {

Callers 2

onchangeFunction · 0.85
selectBorderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected