mirror of
https://github.com/Powerful-517/yys-editor.git
synced 2026-03-05 15:05:27 +00:00
fix(embed): wire local pinia into toolbar store usage
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
<Toolbar
|
<Toolbar
|
||||||
v-if="showToolbar"
|
v-if="showToolbar"
|
||||||
:is-embed="true"
|
:is-embed="true"
|
||||||
|
:pinia-instance="localPinia"
|
||||||
@save="handleSave"
|
@save="handleSave"
|
||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
/>
|
/>
|
||||||
@@ -37,8 +38,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, watch, onMounted, onBeforeUnmount, provide } from 'vue'
|
import { ref, computed, watch, onMounted, onBeforeUnmount } from 'vue'
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia, setActivePinia } from 'pinia'
|
||||||
import LogicFlow from '@logicflow/core'
|
import LogicFlow from '@logicflow/core'
|
||||||
import '@logicflow/core/lib/style/index.css'
|
import '@logicflow/core/lib/style/index.css'
|
||||||
import '@logicflow/extension/lib/style/index.css'
|
import '@logicflow/extension/lib/style/index.css'
|
||||||
@@ -126,7 +127,7 @@ const emit = defineEmits<{
|
|||||||
|
|
||||||
// 创建局部 Pinia 实例(状态隔离)
|
// 创建局部 Pinia 实例(状态隔离)
|
||||||
const localPinia = createPinia()
|
const localPinia = createPinia()
|
||||||
provide('pinia', localPinia)
|
setActivePinia(localPinia)
|
||||||
|
|
||||||
// Refs
|
// Refs
|
||||||
const flowEditorRef = ref<InstanceType<typeof FlowEditor>>()
|
const flowEditorRef = ref<InstanceType<typeof FlowEditor>>()
|
||||||
|
|||||||
@@ -123,8 +123,16 @@ import { ElMessageBox } from "element-plus";
|
|||||||
import { useGlobalMessage } from "@/ts/useGlobalMessage";
|
import { useGlobalMessage } from "@/ts/useGlobalMessage";
|
||||||
import { getLogicFlowInstance } from "@/ts/useLogicFlow";
|
import { getLogicFlowInstance } from "@/ts/useLogicFlow";
|
||||||
import { useCanvasSettings } from '@/ts/useCanvasSettings';
|
import { useCanvasSettings } from '@/ts/useCanvasSettings';
|
||||||
|
import type { Pinia } from 'pinia';
|
||||||
|
|
||||||
const filesStore = useFilesStore();
|
const props = withDefaults(defineProps<{
|
||||||
|
isEmbed?: boolean;
|
||||||
|
piniaInstance?: Pinia;
|
||||||
|
}>(), {
|
||||||
|
isEmbed: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const filesStore = props.piniaInstance ? useFilesStore(props.piniaInstance) : useFilesStore();
|
||||||
const { showMessage } = useGlobalMessage();
|
const { showMessage } = useGlobalMessage();
|
||||||
const { selectionEnabled, snapGridEnabled, snaplineEnabled } = useCanvasSettings();
|
const { selectionEnabled, snapGridEnabled, snaplineEnabled } = useCanvasSettings();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user