Commit b66cb5f4 authored by 郭铭瑶's avatar 郭铭瑶 🤘

测试从外部获取组件资源

parent eef66bef
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import list from '@/utils/component-list' import list, { components as componentObj } from '@/utils/component-list'
import useConfig, { Config } from './useConfig' import useConfig, { Config } from './useConfig'
export default function useComponent() { export default function useComponent() {
...@@ -35,5 +35,6 @@ export default function useComponent() { ...@@ -35,5 +35,6 @@ export default function useComponent() {
openComponentModal, openComponentModal,
onSelectComponent, onSelectComponent,
onCancelComponent, onCancelComponent,
componentObj,
} }
} }
...@@ -5,6 +5,11 @@ import PublicEarning from '@/view/components/public-earning.vue' // 公共收益 ...@@ -5,6 +5,11 @@ import PublicEarning from '@/view/components/public-earning.vue' // 公共收益
import Bid from '@/view/components/bid.vue' // 招投标 import Bid from '@/view/components/bid.vue' // 招投标
import IndustrySupervision from '@/view/components/industry-supervision.vue' // 行业监管 import IndustrySupervision from '@/view/components/industry-supervision.vue' // 行业监管
// import * as vue from 'vue'
// import fetchComponents from 'http://127.0.0.1:8080/com.min.js'
// fetchComponents(vue)
// const { ComSample } = window._components
export default { export default {
w1: Property, w1: Property,
w2: PropertyFeatures, w2: PropertyFeatures,
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, PropType, ref, watch } from 'vue' import { computed, PropType, ref, watch } from 'vue'
import list, { components } from '@/utils/component-list' import useComponent from '@/hooks/useComponent'
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
...@@ -62,18 +62,18 @@ watch( ...@@ -62,18 +62,18 @@ watch(
} }
}, },
) )
const { componentList, componentObj } = useComponent()
const curTab = ref('1') const curTab = ref('1')
const tabs = [ const tabs = [
{ name: '物业', key: '1', list: components['物业'] }, { name: '物业', key: '1', list: componentObj['物业'] },
{ name: '市场', key: '2', list: components['市场'] }, { name: '市场', key: '2', list: componentObj['市场'] },
{ name: '修缮', key: '3', list: components['修缮'] }, { name: '修缮', key: '3', list: componentObj['修缮'] },
{ name: '保障', key: '4', list: components['保障'] }, { name: '保障', key: '4', list: componentObj['保障'] },
] ]
const componentKeys = computed( const componentKeys = computed(
() => tabs.find((e) => e.key === curTab.value)?.list || [], () => tabs.find((e) => e.key === curTab.value)?.list || [],
) )
const componentList = computed(() => list)
const curComponent = ref('') const curComponent = ref('')
const onSelect = (key: string) => { const onSelect = (key: string) => {
if (curComponent.value === key) return if (curComponent.value === key) return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment