<Tabbar id="tabbar"> <TabItem id="home" label="首页"/> <TabItem id="setting" label="设置"/> <TabItem id="logs" label="日志"/> <TabItem id="about" label="关于"/> </Tabbar>
<a id="tabitem"> <Icon id="icon"/> <span id="label">首页</span> </a>
About: {
xml: `<svg width="48" height="48" viewBox="0 0 1024 1024">
<path d="M507.577907 23.272727C240.142852..."/>
</svg>`
},
Home: {
xml: `<svg width="48" height="48" viewBox="0 0 1024 1024">
<path d="M949.082218 519.343245 508.704442..."/>
</svg>`
},
Logs: {
xml: `<svg width="48" height="48" viewBox="0 0 1024 1024">
<path d="M576 125.344l32 0 0 64-32 0 0-64Z..."/>
</svg>`
},
Setting: {
xml: `<svg width="48" height="48" viewBox="0 0 1024 1024">
<path d="M512 336.664c-96.68 0-175.336 78...."/>
</svg>`
}
xmlplus("ui", function (xp, $_, t) {
$_().imports({Tabbar: {... }, TabItem: {...}});
$_("icon").imports({--这里包含了四个图标组件--});
});
Icon: {
css: "#icon { width: 1.5em; height: 1.5em; display: inline-block; }",
opt: { icon: "about" },
xml: `<span id="icon"/>`,
fun: function (sys, items, opts) {
sys.icon.replace("icon/" + opts.icon).addClass("#icon");
}
}
TabItem: {
css: "这里是样式项部分,为便于组件整体展示,略去...",
map: {"attrs": { icon: "id->icon" } },
xml: `<a id="tabitem">
<Icon id="icon"/>
<span id="label">首页</span>
</a>`,
fun: function (sys, items, opts) {
sys.label.text(opts.label);
function select() {
sys.tabitem.addClass("#primary");
}
function unselect() {
sys.tabitem.removeClass("#primary");
}
return { select: select, unselect: unselect };
}
}
Tabbar: {
css: "这里是样式项部分,为便于组件整体展示,略去...",
xml: `<nav id="tabbar"/>`,
fun: function (sys, items, opts) {
var sel = this.first();
this.on("touchend", "./*[@id]", function (e) {
sel.value().unselect();
(sel = this).value().select();
this.trigger("switch", this.toString());
});
if (sel) sel.value().select();
}
}
xmlplus("example", function (xp, $_, t) {
$_().imports({
Index: {
xml: `<Footer id='footer'/>`,
fun: function (sys, items, opts) {
this.on("switch", (e, target) => console.log(target));
}
},
Footer: {
xml: `<Tabbar id="footer">
<TabItem id="home" label="首页"/>
<TabItem id="setting" label="设置"/>
<TabItem id="logs" label="日志"/>
<TabItem id="about" label="关于"/>
</Tabbar>`
}
});
});
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有