fix(ui,runtime): 组件注册默认以magic-ui-xx的形式,不再需要在组件中设置name

fix #291
This commit is contained in:
roymondchen 2022-08-19 11:06:37 +08:00 committed by jia000
parent 143bded648
commit de380357ee
20 changed files with 7 additions and 32 deletions

View File

@ -17,8 +17,6 @@ import { MComponent } from '@tmagic/schema';
import { toLine } from '@tmagic/utils';
export default defineComponent({
name: 'magic-ui-component',
props: {
config: {
type: Object as PropType<MComponent>,

View File

@ -13,7 +13,6 @@ import type { MComponent } from '@tmagic/schema';
import useApp from '../useApp';
export default defineComponent({
name: 'magic-ui-button',
props: {
config: {
type: Object as PropType<MComponent>,

View File

@ -20,8 +20,6 @@ import useApp from '../useApp';
import useCommonMethod from '../useCommonMethod';
export default defineComponent({
name: 'magic-ui-container',
components: {
'magic-ui-component': Component,
},

View File

@ -7,7 +7,6 @@ import { defineComponent } from 'vue';
import useApp from '../../useApp';
export default defineComponent({
name: 'magic-ui-img',
props: {
config: {
type: Object,

View File

@ -12,7 +12,6 @@ import type { MNode } from '@tmagic/schema';
import useApp from '../../useApp';
export default defineComponent({
name: 'magic-ui-overlay',
props: {
config: {
type: Object,

View File

@ -18,8 +18,6 @@ import Component from '../Component.vue';
import useApp from '../useApp';
export default defineComponent({
name: 'magic-ui-page',
components: {
'magic-ui-component': Component,
},

View File

@ -9,8 +9,6 @@ import QRCode from 'qrcode';
import useApp from '../../useApp';
export default defineComponent({
name: 'magic-ui-qrcode',
props: {
config: {
type: Object,

View File

@ -6,8 +6,6 @@ import type { MComponent } from '@tmagic/schema';
import useApp from '../useApp';
export default defineComponent({
name: 'magic-ui-text',
props: {
config: {
type: Object as PropType<MComponent>,

View File

@ -16,8 +16,6 @@ import Core from '@tmagic/core';
import { toLine } from '@tmagic/utils';
export default defineComponent({
name: 'magic-ui-component',
props: {
config: {
type: Object,

View File

@ -12,7 +12,6 @@ import { MButton, MButtonInstance, MText } from '../../../src/types';
import useApp from '../../useApp';
export default defineComponent({
name: 'magic-ui-button',
props: {
config: {
type: Object as PropType<MButton>,

View File

@ -20,8 +20,6 @@ import useApp from '../../useApp';
import useCommonMethod from '../../useCommonMethod';
export default defineComponent({
name: 'magic-ui-container',
components: {
'magic-ui-component': Component,
},

View File

@ -8,7 +8,6 @@ import { MImg } from '../../types';
import useApp from '../../useApp';
export default defineComponent({
name: 'magic-ui-img',
props: {
config: {
type: Object as PropType<MImg>,

View File

@ -12,7 +12,6 @@ import type { MNode } from '@tmagic/schema';
import useApp from '../../useApp';
export default defineComponent({
name: 'magic-ui-overlay',
props: {
config: {
type: Object,

View File

@ -18,8 +18,6 @@ import Component from '../../Component.vue';
import useApp from '../../useApp';
export default defineComponent({
name: 'magic-ui-page',
components: {
'magic-ui-component': Component,
},

View File

@ -10,8 +10,6 @@ import { MQrcode } from '../../types';
import useApp from '../../useApp';
export default defineComponent({
name: 'magic-ui-qrcode',
props: {
config: {
type: Object as PropType<MQrcode>,

View File

@ -5,7 +5,6 @@ import { MComponentInstance, MText, MTextInstance } from '../../../src/types';
import useApp from '../../useApp';
export default defineComponent({
name: 'magic-ui-text',
props: {
config: {
type: Object as PropType<MText>,

View File

@ -37,7 +37,7 @@ const app = new Core({
Object.keys(components).forEach((type: string) => {
const component = components[type];
Vue.component(component.name, component);
Vue.component(`magic-ui-${type}`, component);
app.registerComponent(type, component);
});

View File

@ -21,8 +21,8 @@ import Vue from 'vue';
import App from './App.vue';
Promise.all([import('../.tmagic/comp-entry'), import('../.tmagic/plugin-entry')]).then(([components, plugins]) => {
Object.values(components.default).forEach((component: any) => {
Vue.component(component.name, component);
Object.entries(components.default).forEach(([type, component]: [string, any]) => {
Vue.component(`magic-ui-${type}`, component);
});
Object.values(plugins.default).forEach((plugin: any) => {

View File

@ -32,8 +32,8 @@ const magicApp = createApp(AppComponent);
magicApp.use(request);
Object.values(components).forEach((component: any) => {
magicApp.component(component.name, component);
Object.entries(components).forEach(([type, component]: [string, any]) => {
magicApp.component(`magic-ui-${type}`, component);
});
Object.values(plugins).forEach((plugin: any) => {

View File

@ -23,8 +23,8 @@ import App from './App.vue';
Promise.all([import('../.tmagic/comp-entry'), import('../.tmagic/plugin-entry')]).then(([components, plugins]) => {
const magicApp = createApp(App);
Object.values(components.default).forEach((component: any) => {
magicApp.component(component.name, component);
Object.entries(components.default).forEach(([type, component]: [string, any]) => {
magicApp.component(`magic-ui-${type}`, component);
});
Object.values(plugins.default).forEach((plugin: any) => {