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