mirror of
				https://github.com/Tencent/tmagic-editor.git
				synced 2025-11-04 18:52:18 +08:00 
			
		
		
		
	feat(runtime): vue2 h传参与vue3不一样,需要自定义render
This commit is contained in:
		
							parent
							
								
									91cde30d75
								
							
						
					
					
						commit
						90abde57cc
					
				@ -19,6 +19,7 @@
 | 
				
			|||||||
import Vue from 'vue';
 | 
					import Vue from 'vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import TMagicApp, { DataSourceManager, DeepObservedData, getUrlParam, registerDataSourceOnDemand } from '@tmagic/core';
 | 
					import TMagicApp, { DataSourceManager, DeepObservedData, getUrlParam, registerDataSourceOnDemand } from '@tmagic/core';
 | 
				
			||||||
 | 
					import type { userRenderFunctionOptions } from '@tmagic/vue-runtime-help';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import asyncDataSources from '../.tmagic/async-datasource-entry';
 | 
					import asyncDataSources from '../.tmagic/async-datasource-entry';
 | 
				
			||||||
import components from '../.tmagic/comp-entry';
 | 
					import components from '../.tmagic/comp-entry';
 | 
				
			||||||
@ -64,6 +65,10 @@ registerDataSourceOnDemand(dsl, asyncDataSources).then((dataSources) => {
 | 
				
			|||||||
  const vueApp = new Vue({
 | 
					  const vueApp = new Vue({
 | 
				
			||||||
    provide: {
 | 
					    provide: {
 | 
				
			||||||
      app,
 | 
					      app,
 | 
				
			||||||
 | 
					      userRender: ({ h, type, props, attrs, style, className }: userRenderFunctionOptions) =>
 | 
				
			||||||
 | 
					        // class作为保留字符,android 4.4以下不能直接使用, 需要加引号
 | 
				
			||||||
 | 
					        // eslint-disable-next-line prettier/prettier
 | 
				
			||||||
 | 
					        h(type, { props, attrs, style, 'class': className }),
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    render: (h) => h(AppComponent),
 | 
					    render: (h) => h(AppComponent),
 | 
				
			||||||
 | 
				
			|||||||
@ -19,6 +19,7 @@
 | 
				
			|||||||
import Vue from 'vue';
 | 
					import Vue from 'vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import TMagicApp, { DataSourceManager, DeepObservedData } from '@tmagic/core';
 | 
					import TMagicApp, { DataSourceManager, DeepObservedData } from '@tmagic/core';
 | 
				
			||||||
 | 
					import type { userRenderFunctionOptions } from '@tmagic/vue-runtime-help';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import App from './App.vue';
 | 
					import App from './App.vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -61,6 +62,10 @@ Promise.all([
 | 
				
			|||||||
    render: (h) => h(App),
 | 
					    render: (h) => h(App),
 | 
				
			||||||
    provide: {
 | 
					    provide: {
 | 
				
			||||||
      app,
 | 
					      app,
 | 
				
			||||||
 | 
					      userRender: ({ h, type, props, attrs, style, className }: userRenderFunctionOptions) =>
 | 
				
			||||||
 | 
					        // class作为保留字符,android 4.4以下不能直接使用, 需要加引号
 | 
				
			||||||
 | 
					        // eslint-disable-next-line prettier/prettier
 | 
				
			||||||
 | 
					        h(type, { props, attrs, style, 'class': className }),
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    el: '#app',
 | 
					    el: '#app',
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user