@jiess/core
Version:
基于javascript的配置式渲染库,同时支持vue2,vue3和react
1 lines • 1.89 kB
JavaScript
(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>s});const n="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 r=(...e)=>{};var o;((((()=>{let e})(),()=>{let e=0;return function(t,n=100){let r=(new Date).getTime();r-e>n&&t(),e=r}})(),()=>{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 r=(new Date).getTime();r-e>n&&(e=r,t())}})(),function(e){e.React="react",e.Vue2="vue2",e.Vue3="vue3"}(o||(o={}));const i="vue3";class s{jiess;env=i;constructor(e,t){this.jiess=e,this.initRender(),this.env=e.$env=i,e.JiessComponent=e=>{const{is:n,setup:r,children:o,...i}=e,s={is:n,setup:r,jiessEnv:this};return this.createElement(t(s).start(i,o))}}initRender(){const{$render:e}=this.jiess;"function"==typeof e&&(this.jiess.h=(...t)=>e.call(this,...t))}createElement(e,t,n){const{useDirectives:r,...o}=t||{},{withDirectives:i,h:s}=this.jiess;return"function"==typeof r?i(s(e,o,n),r()):s(e,o,n)}createVNode({key:e},t){const{NativeComponent:n}=t(this);return this.createElement(n,{key:e})}component(e,t){let o=r;return{inheritAttrs:!0,data:()=>({[n]:!1}),created(){e.frame=this,e.frameProps=this.$props,o=t()},beforeMount(){o("beforeMount")},mounted(){o("mounted")},beforeUpdate(){o("beforeUpdate")},updated(){o("updated")},beforeUnmount(){o("beforeUnmount")},render(){return this[n],e.ctx._buildVNodeTree()},methods:{forceUpdate(){this[n]=!this[n]}}}}}module.exports=t})();