@jiess/core
Version:
基于javascript的配置式渲染库,同时支持vue2,vue3和react
1 lines • 1.51 kB
JavaScript
const e="JiessForceUpdate";!function(e={},t="toString"){if("function"==typeof e[t]){if("string"==typeof t){const n=new RegExp(t,"g");return(e[t]+"").replace(n,"")}e[t]}}(),new WeakMap;const t=(...e)=>{};var n;((((()=>{let e})(),()=>{let e=0;return function(t,n=100){let s=(new Date).getTime();s-e>n&&t(),e=s}})(),()=>{let e=!0;return function(t,n=100){e&&(e=!1,setTimeout((()=>{e=!0,t()}),n))}})(),()=>{let e=0;return function(t,n=100){let s=(new Date).getTime();s-e>n&&(e=s,t())}})(),function(e){e.React="react",e.Vue2="vue2",e.Vue3="vue3"}(n||(n={}));const s="vue3";class r{jiess;env=s;constructor(e,t){this.jiess=e,this.initRender(),this.env=e.$env=s,e.JiessComponent=e=>{const{is:n,setup:s,children:r,...i}=e,o={is:n,setup:s,jiessEnv:this};return this.createElement(t(o).start(i,r))}}initRender(){const{$render:e}=this.jiess;"function"==typeof e&&(this.jiess.h=(...t)=>e.call(this,...t))}createElement(e,t,n){const{useDirectives:s,...r}=t||{},{withDirectives:i,h:o}=this.jiess;return"function"==typeof s?i(o(e,r,n),s()):o(e,r,n)}createVNode({key:e},t){const{NativeComponent:n}=t(this);return this.createElement(n,{key:e})}component(n,s){let r=t;return{inheritAttrs:!0,data:()=>({[e]:!1}),created(){n.frame=this,n.frameProps=this.$props,r=s()},beforeMount(){r("beforeMount")},mounted(){r("mounted")},beforeUpdate(){r("beforeUpdate")},updated(){r("updated")},beforeUnmount(){r("beforeUnmount")},render(){return this[e],n.ctx._buildVNodeTree()},methods:{forceUpdate(){this[e]=!this[e]}}}}}export{r as default};