| | |
| | | <template> |
| | | <div class="UI-dynamic" :id="'UI-dynamic-'+areasName+componentVO.oid"> |
| | | <div v-if="isError" style="color: #F56C6C">这个自定义页面的地址格式不正确。推荐使用UI:type#content?param=xxx这种形式</div> |
| | | <component v-else :is="asyncComponent" |
| | | <component v-else :is="currentComponent" |
| | | :customOptions="customOptions" |
| | | :inDialog="inDialog" |
| | | :key="areasName+'customCom-'+componentVO.oid" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | export default { |
| | | name: "dynamic-custom", |
| | | props:{ |
| | |
| | | }, |
| | | }, |
| | | components:{ |
| | | |
| | | 'my-dynamic-component': ()=>import('@/views/base/UIContentViewerInDialog') |
| | | }, |
| | | data() { |
| | | return { |
| | | customClass:this.componentVO.customClass, //UI:type#content?param=xxx或者 组件name:type#content?param=xxx |
| | | isError:false, //路径解析失败 |
| | | componentPath:'@/views/base/UIContentViewer' //自定义使用的组件路径 |
| | | currentComponent: 'my-dynamic-component', |
| | | componentPath:'@/views/base/UIContentViewerInDialog' //自定义使用的组件路径 |
| | | } |
| | | }, |
| | | computed:{ |
| | | customOptions() { |
| | | let componentPath='@/views/base/UIContentViewer'; |
| | | let componentPath='@/views/base/UIContentViewerInDialog'; |
| | | if(this.customClass.indexOf(":") <0){ |
| | | this.isError=true; |
| | | return ; |
| | |
| | | } |
| | | }, |
| | | created() { |
| | | |
| | | debugger; |
| | | this.components["my-dynamic-component"] = import(this.componentPath); |
| | | } |
| | | } |
| | | </script> |