This commit is contained in:
2026-02-09 17:32:14 +08:00
parent 9871ef0c87
commit e090e4383a
3 changed files with 23 additions and 15 deletions

View File

@@ -1,12 +1,12 @@
<template> <template>
<div class="card"> <div class="card">
<div class="header"> <div class="header">
<svg-icon :name="currentComponent.type" color="#fff" /> <svg-icon :name="currentComponent?.type" color="#fff" />
<span>{{ currentComponent.title }}</span> <span>{{ currentComponent?.title }}</span>
<div class="add" @click="emit('add')"><svg-icon name="add" size="14" /></div> <div class="add" @click="emit('add')"><svg-icon name="add" size="14" /></div>
</div> </div>
<div class="body"> <div class="body">
<component :is="currentComponent.component" ref="componentRef" /> <component :is="currentComponent?.component" ref="componentRef" />
</div> </div>
<div class="footer"> <div class="footer">
<button @click="onGenerateClick"> <button @click="onGenerateClick">
@@ -19,15 +19,15 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref, markRaw, onMounted } from 'vue' import { computed, ref, markRaw, onMounted } from 'vue'
import ToRealStyle from './cards/to-real-style.vue' import ToRealStyle from './to-real-style.vue'
import SceneComposition from './cards/scene-composition.vue' import SceneComposition from './scene-composition.vue'
import ColorPalette from './cards/color-palette.vue' import ColorPalette from './color-palette.vue'
import ToVideo from './cards/to-video.vue' import ToVideo from './to-video.vue'
import To3DModel from './cards/to-3d-model.vue' import To3DModel from './to-3d-model.vue'
import AddPrint from './cards/add-print.vue' import AddPrint from './add-print.vue'
import ToCAD from './cards/to-cad.vue' import ToCAD from './to-cad.vue'
import EditMaterial from './cards/edit-material.vue' import EditMaterial from './edit-material.vue'
const components = [ const components = [
{ {
type: 'to-real-style', type: 'to-real-style',
@@ -73,7 +73,15 @@
const emit = defineEmits(['add', 'generate']) const emit = defineEmits(['add', 'generate'])
const props = defineProps({ const props = defineProps({
type: { type: {
type: String, type: String as () =>
| 'to-real-style'
| 'scene-composition'
| 'color-palette'
| 'to-video'
| 'to-3d-model'
| 'to-cad'
| 'add-print'
| 'edit-material',
default: 'to-real-style' default: 'to-real-style'
} }
}) })

View File

@@ -23,10 +23,10 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, defineProps, defineEmits, watch, computed } from 'vue' import { ref, watch, computed } from 'vue'
import MyInput from './my-input.vue' import MyInput from './my-input.vue'
const props = defineProps({ const props = defineProps({
modelValue: { type: Object }, modelValue: { type: Object as () => { x: number; y: number } },
showInput: { showInput: {
type: Boolean, type: Boolean,
default: true default: true

View File

@@ -12,7 +12,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import card from './components/card.vue' import card from './components/cards/index.vue'
import { computed, ref, markRaw, onMounted } from 'vue' import { computed, ref, markRaw, onMounted } from 'vue'
import { useGlobalStore } from '@/stores' import { useGlobalStore } from '@/stores'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'