Files
dvcp_v2_webapp/ui/packages/wx/AiOpenData.vue

42 lines
801 B
Vue
Raw Normal View History

<template>
<ww-open-data class="AiOpenData" :type="type" :openid="oid"/>
</template>
<script>
import {mapActions} from "vuex"
export default {
name: "AiOpenData",
props: {
/**
* open-data 的类型,详情参见具体:https://work.weixin.qq.com/api/doc/90001/90143/91958
* @values departmentName,userName
*/
type: String,
/**
* 数据ID根据type取值而定
*/
openid: {default: ""},
},
computed: {
oid() {
/**
* 后端返回格式(cropId|userId)
*/
return this.openid?.toString()?.split("|")?.[1] || this.openid || ""
}
},
methods: {
...mapActions(['initOpenData'])
},
watch: {
openid: {
handler(v) {
v && this.initOpenData()
},
immediate: true
}
},
}
</script>