添加跟换图片功能

This commit is contained in:
hantao 2026-01-30 16:38:30 +08:00
parent f4c6de2e9d
commit 6481604b95
6 changed files with 281 additions and 610 deletions

View File

@ -12,6 +12,7 @@
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@kitschpatrol/tweakpane-plugin-image": "^2.0.1-beta.8",
"@tweakpane/plugin-essentials": "^0.2.1", "@tweakpane/plugin-essentials": "^0.2.1",
"hover-tilt": "^1.0.0", "hover-tilt": "^1.0.0",
"lodash-es": "^4.17.23", "lodash-es": "^4.17.23",

View File

@ -30,7 +30,7 @@ import Editor from './components/Editor.vue';
} }
.editor-zone { .editor-zone {
width: 350px; width: 600px;
overflow-y: auto; overflow-y: auto;
} }
} }

View File

@ -19,7 +19,7 @@ img {
<!-- 利用这个元素承载 style 穿透到hover-tilt --> <!-- 利用这个元素承载 style 穿透到hover-tilt -->
<div class="container" :style="borderRadiusStyle"> <div class="container" :style="borderRadiusStyle">
<hover-tilt v-bind="tilt_store.tiltProps" class="hover-tilt"> <hover-tilt v-bind="tilt_store.tiltProps" class="hover-tilt">
<img src="https://images.pokemontcg.io/swsh4/25_hires.png" :style="store.imageStyle" /> <img :src="store.formData.image.src" :style="store.imageStyle" />
</hover-tilt> </hover-tilt>
</div> </div>
</template> </template>

View File

@ -5,6 +5,7 @@ import { useEditorStore } from "@/stores/editor"
import { onMounted, ref } from 'vue' import { onMounted, ref } from 'vue'
import { Pane } from 'tweakpane' import { Pane } from 'tweakpane'
import { useHoverTiltStore } from "@/stores/hoverTilt" import { useHoverTiltStore } from "@/stores/hoverTilt"
import * as ImagePlugin from '@kitschpatrol/tweakpane-plugin-image';
const editorStore = useEditorStore() const editorStore = useEditorStore()
const hoverTiltStore = useHoverTiltStore() const hoverTiltStore = useHoverTiltStore()
@ -16,6 +17,7 @@ function createPane(container: HTMLDivElement) {
// pane // pane
const pane = new Pane({ container }) const pane = new Pane({ container })
pane.registerPlugin(ImagePlugin);
const editorFolderInstance = pane.addFolder({ const editorFolderInstance = pane.addFolder({
title: EditorFolder.label, title: EditorFolder.label,
expanded: true expanded: true

View File

@ -1,4 +1,12 @@
const editorConfig = [ const editorConfig = [
{
label: "image",
value: '',
params: {
view: 'input-image',
label: 'Preview',
}
},
{ {
label: "border-radius", label: "border-radius",
value: 10, value: 10,

876
yarn.lock

File diff suppressed because it is too large Load Diff