no message
parent
f75c3f4d98
commit
2e5cafd75f
|
|
@ -7,7 +7,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useEventBus, useProp } from 'open-data-v/base'
|
||||
import { useData, useEventBus, useProp } from 'open-data-v/base'
|
||||
import { onMounted, ref } from 'vue'
|
||||
|
||||
import { http } from '@/utils/http'
|
||||
|
|
@ -30,25 +30,26 @@ const resizeHandler = (entry: ResizeObserverEntry) => {
|
|||
|
||||
const dataHandler = (event) => {
|
||||
console.log(event)
|
||||
const item: Record<string, any> = event as Record<string, any>
|
||||
if (propValue.base.tag && item[propValue.base.tag] !== undefined) {
|
||||
customeText.value = item[propValue.base.tag]
|
||||
}
|
||||
customeText.value=event
|
||||
}
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const queryParems = { tag: propValue.base.tag }
|
||||
const res = await http.get({ url: propValue.base.url, params: queryParems })
|
||||
|
||||
if (res.status === 200 && Object.keys(res.data).includes(propValue.base.tag)) {
|
||||
dataHandler(res.data)
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.log(error?.message)
|
||||
}
|
||||
})
|
||||
const dataChange = (resp: any, _?: string) => {
|
||||
console.log(resp)
|
||||
if (!resp || !resp.data) {
|
||||
console.log("数据失败-----")
|
||||
return
|
||||
}
|
||||
if (resp.status === 'SUCCESS') {
|
||||
console.log(resp.data.data)
|
||||
dataHandler(resp.data.data)
|
||||
}
|
||||
|
||||
useEventBus('39bcfcba452344dea4f34e9d068a8f6e', dataHandler)
|
||||
}
|
||||
|
||||
useData(props.component, dataChange)
|
||||
useEventBus('globalData', dataHandler)
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
|
|
|||
Loading…
Reference in New Issue