epic-designer
Version:
基于vue3的设计器,可视化开发页面表单
2 lines (1 loc) • 970 B
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue");function p(){const u=a.ref([]),l=a.ref([]),e=a.ref(null);let r=0;function s(n,t="插入组件"){var v;t==="加载数据"&&((v=e.value)==null?void 0:v.type)==="初始化"&&(e.value={componentSchema:JSON.stringify(n),type:t});const o=Date.now();r+150>o||(r=o,e.value!==null&&(u.value.push(e.value),l.value.splice(0,l.value.length)),e.value={componentSchema:JSON.stringify(n),type:t},u.value.length>60&&u.value.unshift())}function i(){if(u.value.length===0)return!1;const n=u.value.pop();return e.value!==null&&l.value.push(e.value),e.value=n,JSON.parse(n.componentSchema)}function c(){if(l.value.length===0)return!1;const n=l.value.pop();return e.value!==null&&u.value.push(e.value),e.value=n,JSON.parse(n.componentSchema)}function f(){u.value=[],l.value=[],e.value=null}return{currentRecord:e,push:s,recordList:u,redo:c,reset:f,undo:i,undoList:l}}exports.useRevoke=p;