Ai
1 Star 2 Fork 1

旻天信息/mttk-vue-wrap

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
MttkWrapComp.vue 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
旻天信息 提交于 2025-02-06 16:44 +08:00 . v0..3.0
<script lang="ts">
import {defineComponent,provide,SetupContext} from 'vue'
import { useCompBase } from './compBase'
import {WrapPropsType,WrapConfigType,SlotParaType,ContextWrapType} from './types'
//
export default defineComponent({
//Set to false to avoid events set on MttkWrapComp to be automatically apply to config root component
inheritAttrs: true,
emits: ['initWrap'],
props: {
//Standard config
config:{
type:Object as () => WrapConfigType
},
//To build the component hierachy
contextParent: {
type: Object as () => ContextWrapType,
required: false,
default() {
//If not provided, try to inject from parent's provide
// return inject('contextWrap')
return undefined
}
},
//The slot para if it is under a slot;undefined if it is a root component
slotPara: {
type: Object as () => SlotParaType,
required: false,
default() {
return undefined
}
},
},
setup(props:WrapPropsType, context:SetupContext) {
//
const {wrapRender,contextWrap} = useCompBase(props, context)
//
// regiesterLifeCycles()
// Expose public function
//getRef: return the component instance
context.expose(contextWrap);
//
provide('contextWrap',contextWrap)
//
context.emit('initWrap',contextWrap)
//
return () => wrapRender()
},
})
</script>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/jamie0828/mttk-vue-wrap.git
git@gitee.com:jamie0828/mttk-vue-wrap.git
jamie0828
mttk-vue-wrap
mttk-vue-wrap
master

搜索帮助