组件结构检视图
Components
Structure
@@ -12,26 +12,13 @@
-
+
-
+
@@ -41,81 +28,33 @@
+
\ No newline at end of file
diff --git a/src/libs/store.js b/src/libs/store.js
new file mode 100644
index 0000000..63f5c66
--- /dev/null
+++ b/src/libs/store.js
@@ -0,0 +1,24 @@
+import { createStore } from 'vuex'
+
+const store = createStore({
+ state() {
+ return {
+ count: 0,
+ currentEditComp: null,
+ renderCount: 0
+ }
+ },
+ mutations: {
+ increment(state) {
+ state.count++
+ },
+ storeCurrentEditComp(state, newComp) {
+ state.currentEditComp = newComp;
+ },
+ onDragEnd(state) {
+ state.renderCount++;
+ }
+ }
+})
+
+globalApp.use(store);
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index 9ed3967..5d21b76 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,4 +1,4 @@
-import { createApp, compile } from "vue";
+import { createApp } from "vue";
import ElementPlus from "element-plus";
import { QuestionFilled, CirclePlus, DocumentCopy, Delete, Refresh, Minus } from "@element-plus/icons";
@@ -19,8 +19,12 @@ function createBaseApp(renderComponent = {}) {
return app;
}
-createBaseApp(APP).mount("#app");
+const globalApp = createBaseApp(APP)
+globalApp.mount("#app");
// 内部需要同样配置的全局Vue
self.createBaseApp = createBaseApp;
-self.compile = compile;
+self.globalApp = globalApp; // 内部需要使用Vuex
+
+
+import("@/libs/store.js");
\ No newline at end of file