test: 无界降级测试加载渲染器
This commit is contained in:
		
							parent
							
								
									8e208e7468
								
							
						
					
					
						commit
						3861919c4f
					
				| @ -10,6 +10,6 @@ VITE_PORT = 10011 | |||||||
| 
 | 
 | ||||||
| VITE_DEBUG_MODE = true | VITE_DEBUG_MODE = true | ||||||
| 
 | 
 | ||||||
| VITE_PLATFORM_URL = 'https://localhost:10010/' | VITE_PLATFORM_URL = 'https://localhost:10010' | ||||||
| VITE_DESIGNER_URL = 'https://localhost:10011/' | VITE_DESIGNER_URL = 'https://localhost:10011' | ||||||
| VITE_RENDERER_URL = 'https://localhost:10012/' | VITE_RENDERER_URL = 'https://localhost:10012' | ||||||
|  | |||||||
| @ -11,6 +11,6 @@ VITE_PORT = 10011 | |||||||
| 
 | 
 | ||||||
| VITE_DEBUG_MODE = true | VITE_DEBUG_MODE = true | ||||||
| 
 | 
 | ||||||
| VITE_PLATFORM_URL = 'https://localhost:10010/' | VITE_PLATFORM_URL = 'https://localhost:10010' | ||||||
| VITE_DESIGNER_URL = 'https://localhost:10011/' | VITE_DESIGNER_URL = 'https://localhost:10011' | ||||||
| VITE_RENDERER_URL = 'https://localhost:10012/' | VITE_RENDERER_URL = 'https://localhost:10012' | ||||||
|  | |||||||
| @ -10,6 +10,6 @@ VITE_BASE_API_URL = 'https://custom-chart-api.shiyuegame.com/' | |||||||
| 
 | 
 | ||||||
| VITE_DEBUG_MODE = true | VITE_DEBUG_MODE = true | ||||||
| 
 | 
 | ||||||
| VITE_PLATFORM_URL = 'https://localhost:10010/' | VITE_PLATFORM_URL = 'https://localhost:10010' | ||||||
| VITE_DESIGNER_URL = 'https://localhost:10011/' | VITE_DESIGNER_URL = 'https://localhost:10011' | ||||||
| VITE_RENDERER_URL = 'https://localhost:10012/' | VITE_RENDERER_URL = 'https://localhost:10012' | ||||||
|  | |||||||
| @ -30,8 +30,8 @@ VITE_PORT=10010 | |||||||
| 
 | 
 | ||||||
| VITE_DEBUG_MODE = true | VITE_DEBUG_MODE = true | ||||||
| 
 | 
 | ||||||
| VITE_PLATFORM_URL = 'https://localhost:10010/' | VITE_PLATFORM_URL = 'https://localhost:10010' | ||||||
| VITE_DESIGNER_URL = 'https://localhost:10011/' | VITE_DESIGNER_URL = 'https://localhost:10011' | ||||||
| VITE_RENDERER_URL = 'https://localhost:10012/' | VITE_RENDERER_URL = 'https://localhost:10012' | ||||||
| VITE_V1_URL = 'https://localhost:10013/' | VITE_V1_URL = 'https://localhost:10013' | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ VITE_DEBUG_MODE = true | |||||||
| 
 | 
 | ||||||
| VITE_PORT=10010 | VITE_PORT=10010 | ||||||
| 
 | 
 | ||||||
| VITE_PLATFORM_URL = 'https://localhost:10010/' | VITE_PLATFORM_URL = 'https://localhost:10010' | ||||||
| VITE_DESIGNER_URL = 'https://localhost:10011/' | VITE_DESIGNER_URL = 'https://localhost:10011' | ||||||
| VITE_RENDERER_URL = 'https://localhost:10012/' | VITE_RENDERER_URL = 'https://localhost:10012' | ||||||
| VITE_V1_URL = 'https://localhost:10013/' | VITE_V1_URL = 'https://localhost:10013' | ||||||
|  | |||||||
| @ -26,7 +26,7 @@ VITE_BASE_API_URL = 'https://custom-chart-pre-api.shiyue.com/' | |||||||
| VITE_DEBUG_MODE = true | VITE_DEBUG_MODE = true | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| VITE_PLATFORM_URL = 'https://localhost:10010/' | VITE_PLATFORM_URL = 'https://localhost:10010' | ||||||
| VITE_DESIGNER_URL = 'https://localhost:10011/' | VITE_DESIGNER_URL = 'https://localhost:10011' | ||||||
| VITE_RENDERER_URL = 'https://localhost:10012/' | VITE_RENDERER_URL = 'https://localhost:10012' | ||||||
| VITE_V1_URL = 'https://localhost:10013/' | VITE_V1_URL = 'https://localhost:10013' | ||||||
|  | |||||||
| @ -2,8 +2,6 @@ import type { RouteRecordRaw } from 'vue-router'; | |||||||
| 
 | 
 | ||||||
| import WujieVueRendererAdapter from '@sy/wujie-vue3-renderer-adapter'; | import WujieVueRendererAdapter from '@sy/wujie-vue3-renderer-adapter'; | ||||||
| 
 | 
 | ||||||
| import { VITE_RENDERER_URL } from '#/constants'; |  | ||||||
| 
 |  | ||||||
| const routes: RouteRecordRaw[] = [ | const routes: RouteRecordRaw[] = [ | ||||||
|   { |   { | ||||||
|     path: '/static-file', |     path: '/static-file', | ||||||
| @ -24,12 +22,15 @@ const routes: RouteRecordRaw[] = [ | |||||||
|           title: '静态文件列表', |           title: '静态文件列表', | ||||||
|         }, |         }, | ||||||
|         props: { |         props: { | ||||||
|           // url: `${VITE_RENDERER_URL}/?fileId=7pfr394d6&projectId=4`,
 |           url: `${VITE_RENDERER_URL}?fileId=7pfr394d6&projectId=4`, | ||||||
|           url: `${VITE_RENDERER_URL}`, |           // url: `${VITE_RENDERER_URL}`,
 | ||||||
|           accessToken: localStorage.getItem('y-code-access-token'), |           // accessToken: localStorage.getItem('y-code-access-token'),
 | ||||||
|           fileId: '7pfr394d6', |           fileId: '7pfr394d6', | ||||||
|           projectId: '4', |           projectId: '4', | ||||||
|           name: 'y-code-renderer', |           name: 'StaticFileList', | ||||||
|  |           sync: true, | ||||||
|  |           degrade: true, | ||||||
|  |           // url: 'https://react.dev/',
 | ||||||
|         }, |         }, | ||||||
|       }, |       }, | ||||||
|     ], |     ], | ||||||
|  | |||||||
| @ -10,6 +10,6 @@ VITE_DEBUG_MODE = true | |||||||
| 
 | 
 | ||||||
| VITE_PORT = 10012 | VITE_PORT = 10012 | ||||||
| 
 | 
 | ||||||
| VITE_PLATFORM_URL = 'https://localhost:10010/' | VITE_PLATFORM_URL = 'https://localhost:10010' | ||||||
| VITE_DESIGNER_URL = 'https://localhost:10011/' | VITE_DESIGNER_URL = 'https://localhost:10011' | ||||||
| VITE_RENDERER_URL = 'https://localhost:10012/' | VITE_RENDERER_URL = 'https://localhost:10012' | ||||||
|  | |||||||
| @ -11,6 +11,6 @@ VITE_BASE_API_URL = 'https://custom-chart-pre-api.shiyue.com/' | |||||||
| 
 | 
 | ||||||
| VITE_DEBUG_MODE = true | VITE_DEBUG_MODE = true | ||||||
| 
 | 
 | ||||||
| VITE_PLATFORM_URL = 'https://localhost:10010/' | VITE_PLATFORM_URL = 'https://localhost:10010' | ||||||
| VITE_DESIGNER_URL = 'https://localhost:10011/' | VITE_DESIGNER_URL = 'https://localhost:10011' | ||||||
| VITE_RENDERER_URL = 'https://localhost:10012/' | VITE_RENDERER_URL = 'https://localhost:10012' | ||||||
|  | |||||||
| @ -11,6 +11,6 @@ VITE_BASE_API_URL = 'https://custom-chart-api.shiyuegame.com/' | |||||||
| 
 | 
 | ||||||
| VITE_DEBUG_MODE = true | VITE_DEBUG_MODE = true | ||||||
| 
 | 
 | ||||||
| VITE_PLATFORM_URL = 'https://localhost:10010/' | VITE_PLATFORM_URL = 'https://localhost:10010' | ||||||
| VITE_DESIGNER_URL = 'https://localhost:10011/' | VITE_DESIGNER_URL = 'https://localhost:10011' | ||||||
| VITE_RENDERER_URL = 'https://localhost:10012/' | VITE_RENDERER_URL = 'https://localhost:10012' | ||||||
|  | |||||||
| @ -9,9 +9,6 @@ import Postmate from 'postmate'; | |||||||
| 
 | 
 | ||||||
| import { LowCodeService } from './service'; | import { LowCodeService } from './service'; | ||||||
| 
 | 
 | ||||||
| const test = window.$wujie?.props; // {data: xxx, methods: xxx} |  | ||||||
| console.log('test', test); |  | ||||||
| 
 |  | ||||||
| // 文件加载时,清空一次 sessionStorage | // 文件加载时,清空一次 sessionStorage | ||||||
| sessionStorage.clear(); | sessionStorage.clear(); | ||||||
| 
 | 
 | ||||||
| @ -24,6 +21,7 @@ const accessToken = ref(''); | |||||||
| const urlParams = ref(parseUrlParams()); | const urlParams = ref(parseUrlParams()); | ||||||
| const provider = ref(null); | const provider = ref(null); | ||||||
| 
 | 
 | ||||||
|  | // 从 URL 解析参数 | ||||||
| function parseUrlParams() { | function parseUrlParams() { | ||||||
|   const urlParams = new URLSearchParams(window.location.search); |   const urlParams = new URLSearchParams(window.location.search); | ||||||
|   const params = { |   const params = { | ||||||
|  | |||||||
| @ -130,7 +130,7 @@ onMounted(async () => { | |||||||
| 
 | 
 | ||||||
| <template> | <template> | ||||||
|   <div style="padding: 20px"> |   <div style="padding: 20px"> | ||||||
|     <component :is="renderer" v-if="renderer" /> |     <component :is="renderer" v-if="renderer" :wujie-props="wujieProps" /> | ||||||
|     <div |     <div | ||||||
|       v-else-if="!isLoading" |       v-else-if="!isLoading" | ||||||
|       style="margin-top: 50px; color: red; text-align: center" |       style="margin-top: 50px; color: red; text-align: center" | ||||||
|  | |||||||
| @ -4,11 +4,14 @@ import { onBeforeUnmount, onMounted } from 'vue'; | |||||||
| import WujieVue from 'wujie-vue3'; | import WujieVue from 'wujie-vue3'; | ||||||
| 
 | 
 | ||||||
| const props = defineProps<{ | const props = defineProps<{ | ||||||
|  |   [key: string]: any; | ||||||
|   accessToken?: string; |   accessToken?: string; | ||||||
|   applicationId: number | string; |   applicationId: number | string; | ||||||
|  |   degrade?: boolean; | ||||||
|   fileId: number | string; |   fileId: number | string; | ||||||
|   name: string; |   name: string; | ||||||
|   projectId: number | string; |   projectId: number | string; | ||||||
|  |   sync: boolean; | ||||||
|   url: string; |   url: string; | ||||||
| }>(); | }>(); | ||||||
| 
 | 
 | ||||||
| @ -16,14 +19,6 @@ console.log('props', props); | |||||||
| 
 | 
 | ||||||
| const { bus } = WujieVue; | const { bus } = WujieVue; | ||||||
| 
 | 
 | ||||||
| // 传递给子应用的属性 |  | ||||||
| const subAppProps = { |  | ||||||
|   accessToken: props.accessToken, |  | ||||||
|   applicationId: props.applicationId, |  | ||||||
|   fileId: props.fileId, |  | ||||||
|   projectId: props.projectId, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| // 生命周期钩子 | // 生命周期钩子 | ||||||
| const beforeLoad = (appWindow: Window) => { | const beforeLoad = (appWindow: Window) => { | ||||||
|   console.log(`${props.name} 开始加载`, appWindow); |   console.log(`${props.name} 开始加载`, appWindow); | ||||||
| @ -46,24 +41,17 @@ onBeforeUnmount(() => { | |||||||
|   bus.$off('message', handleMessage); |   bus.$off('message', handleMessage); | ||||||
| }); | }); | ||||||
| </script> | </script> | ||||||
| 
 |  | ||||||
| <template> | <template> | ||||||
|   <div class="low-code-adapter" style="width: 100%; height: 100%"> |   {{ props }} | ||||||
|     {{ url }} |   <WujieVue | ||||||
|     {{ name }} |     :name="name" | ||||||
|     <WujieVue |     :url="url" | ||||||
|       :name="name" |     :sync="sync" | ||||||
|       :url="url" |     :degrade="degrade" | ||||||
|       width="100%" |     width="100%" | ||||||
|       height="100%" |     height="100%" | ||||||
|       :props="subAppProps" |     :props="props" | ||||||
|     /> |     :before-load="beforeLoad" | ||||||
|   </div> |     :after-mount="afterMount" | ||||||
|  |   /> | ||||||
| </template> | </template> | ||||||
| 
 |  | ||||||
| <style scoped> |  | ||||||
| .low-code-adapter { |  | ||||||
|   width: 100%; |  | ||||||
|   height: 100%; |  | ||||||
| } |  | ||||||
| </style> |  | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 wangxuefeng
						wangxuefeng