import { shortcut, Widget, UUID } from "@/core"; import { Layers } from "@/base"; @shortcut() export class Func extends Widget { static xtype = "demo.layer"; props = { baseCls: "demo-func" }; render() { const self = this, id1 = UUID(), id2 = UUID(); return { type: "bi.vertical", vgap: 10, items: [ { type: "bi.button", text: "create形式创建layer, 遮住当前面板, 返回创建的面板对象", height: 30, handler() { Layers.create(id1, self, { // 偏移量 offset: { left: 10, right: 10, top: 10, bottom: 10, }, type: "bi.center_adapt", cls: "bi-card", items: [ { type: "bi.button", text: "点击关闭", handler() { Layers.hide(id1); }, } ], }); Layers.show(id1); }, }, { type: "bi.button", text: "make形式创建layer,可以指定放到哪个面板内,这里指定当前面板(默认放在body下撑满), 返回创建的面板对象", height: 30, handler() { Layers.make(id2, self, { // 偏移量 offset: { left: 10, right: 10, top: 10, bottom: 10, }, type: "bi.center_adapt", cls: "bi-card", items: [ { type: "bi.button", text: "点击关闭", handler() { Layers.remove(id2); }, } ], }); Layers.show(id2); }, } ], }; } }