web:add missing callbacks
This commit is contained in:
parent
526234b878
commit
17addc232a
3
doric-web/dist/index.js
vendored
3
doric-web/dist/index.js
vendored
@ -4433,7 +4433,6 @@ var doric_web = (function (exports, axios, sandbox) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.LayoutSpec = void 0;
|
|
||||||
(function (LayoutSpec) {
|
(function (LayoutSpec) {
|
||||||
LayoutSpec[LayoutSpec["EXACTLY"] = 0] = "EXACTLY";
|
LayoutSpec[LayoutSpec["EXACTLY"] = 0] = "EXACTLY";
|
||||||
LayoutSpec[LayoutSpec["WRAP_CONTENT"] = 1] = "WRAP_CONTENT";
|
LayoutSpec[LayoutSpec["WRAP_CONTENT"] = 1] = "WRAP_CONTENT";
|
||||||
@ -5915,8 +5914,6 @@ ${content}
|
|||||||
exports.toPixelString = toPixelString;
|
exports.toPixelString = toPixelString;
|
||||||
exports.toRGBAString = toRGBAString;
|
exports.toRGBAString = toRGBAString;
|
||||||
|
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
|
||||||
|
|
||||||
return exports;
|
return exports;
|
||||||
|
|
||||||
}({}, axios, doric));
|
}({}, axios, doric));
|
||||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@ -24,7 +24,7 @@
|
|||||||
点击返回
|
点击返回
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<doric-div src="../doric-demo/bundle/src/PopoverDemo.js" alias="test">
|
<doric-div src="../doric-demo/bundle/src/NavigatorDemo.js" alias="test">
|
||||||
</doric-div>
|
</doric-div>
|
||||||
</doric-navigation>
|
</doric-navigation>
|
||||||
<script type="text/javascript" src="./dist/index.js"></script>
|
<script type="text/javascript" src="./dist/index.js"></script>
|
||||||
|
@ -39,9 +39,27 @@ export class DoricContext {
|
|||||||
return Reflect.apply(jsCallEntityMethod, this.panel, argumentsList)
|
return Reflect.apply(jsCallEntityMethod, this.panel, argumentsList)
|
||||||
}
|
}
|
||||||
|
|
||||||
init(extra?: object) {
|
init(data?: string) {
|
||||||
this.invokeEntityMethod("__init__", extra ? JSON.stringify(extra) : undefined)
|
this.invokeEntityMethod("__init__", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onCreate() {
|
||||||
|
this.invokeEntityMethod("__onCreate__")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onDestroy() {
|
||||||
|
this.invokeEntityMethod("__onDestroy__")
|
||||||
|
}
|
||||||
|
|
||||||
|
onShow() {
|
||||||
|
this.invokeEntityMethod("__onShow__")
|
||||||
|
}
|
||||||
|
|
||||||
|
onHidden() {
|
||||||
|
this.invokeEntityMethod("__onHidden__")
|
||||||
|
}
|
||||||
|
|
||||||
build(frame: {
|
build(frame: {
|
||||||
width: number,
|
width: number,
|
||||||
height: number,
|
height: number,
|
||||||
|
@ -21,9 +21,17 @@ export class DoricElement extends HTMLElement {
|
|||||||
this.setAttribute('alias', v)
|
this.setAttribute('alias', v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get initData() {
|
||||||
|
return this.getAttribute('data') as string
|
||||||
|
}
|
||||||
|
|
||||||
|
set initData(v: string) {
|
||||||
|
this.setAttribute('data', v)
|
||||||
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
if (this.src && this.context === undefined) {
|
if (this.src && this.context === undefined) {
|
||||||
axios.get<string>(this.src).then(result => {
|
axios.get(this.src).then(result => {
|
||||||
this.load(result.data)
|
this.load(result.data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -41,11 +49,14 @@ export class DoricElement extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onDestroy() {
|
onDestroy() {
|
||||||
|
this.context?.onDestroy()
|
||||||
this.context?.teardown()
|
this.context?.teardown()
|
||||||
}
|
}
|
||||||
|
|
||||||
load(content: string) {
|
load(content: string) {
|
||||||
this.context = new DoricContext(content)
|
this.context = new DoricContext(content)
|
||||||
|
this.context.init(this.initData)
|
||||||
|
this.context.onCreate()
|
||||||
const divElement = document.createElement('div')
|
const divElement = document.createElement('div')
|
||||||
divElement.style.position = 'relative'
|
divElement.style.position = 'relative'
|
||||||
divElement.style.height = '100%'
|
divElement.style.height = '100%'
|
||||||
@ -55,5 +66,6 @@ export class DoricElement extends HTMLElement {
|
|||||||
width: divElement.offsetWidth,
|
width: divElement.offsetWidth,
|
||||||
height: divElement.offsetHeight,
|
height: divElement.offsetHeight,
|
||||||
})
|
})
|
||||||
|
this.context.onShow()
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user