最近在改電子木魚,如何顯示點擊數和點擊改造型?
JavaScript:
try {
(() => {
var e = __$$hmAppManager$$__.currentApp;
var t = e.current,
{
px: o
} = (new DeviceRuntimeCore.WidgetFactory(
new DeviceRuntimeCore.HmDomApi(e, t)),
e.app.__globals__);
try {
(() => {
var e = __$$hmAppManager$$__.currentApp,
t = e.current;
new DeviceRuntimeCore.WidgetFactory(
new DeviceRuntimeCore.HmDomApi(e, t),
"drink");
DeviceRuntimeCore.HmLogger.getLogger("sanjiao");
t.module = DeviceRuntimeCore.Page({
init_view() {
/* 小米手环7并未适配小程序,
因此所有小程序均以480*480大小渲染,
而小米手环7分辨率192*490,
下方10px像素无法利用,
有超出h480的组件就能上下滑动 */
/*本程序由Lisk独立开发
*/
hmUI.setLayerScrolling(false); //禁用页面上下滑动
var mav = 0;
//背景
hmUI.createWidget(hmUI.widget.IMG, {
x: 74,
y: 23,
src: "help.png"
})
.addEventListener(hmUI.event.CLICK_DOWN, function(a) {
hmApp.gotoPage({
url: "page/192x490_s_l66/index.page2",
param: "..."
})
})
hmUI.createWidget(hmUI.widget.IMG, {
x: 0,
y: 150,
w: 192,
h: 192,
src: "muyu.png",
show_level: hmUI.show_level.ONLY_NORMAL
})
.addEventListener(hmUI.event.CLICK_DOWN, function(a) {
if(1){
hmUI.showToast({
text: 'pop'
})
mav++
}
})
hmUI.
/*亮度控制 */
/*
//返回按钮 (弃用)
hmUI.createWidget(hmUI.widget.BUTTON, {
x: 76,
y: 18,
w: 40,
h: 29,
radius: 20,
normal_color: 0x2DCB6C,
press_color: 0x2DCB6C,
text: '返回',
color: 0xFFFFFF, //文本颜色
click_func: () => {
hmApp.gotoHome()
}
})
*/
hmUI.createWidget(hmUI.widget.TEXT, {
x: 20,
y: 370,
w: 160,
h: 100,
color: 0xffffff,
text_size: 20,
align_h: hmUI.align.CENTER_H,
align_v: hmUI.align.CENTER_V,
text_style: hmUI.text_style.NONE,
text: 'pop:'+mav
})
},
onInit() {
console.log("index page.js on init invoke"), this.init_view();
},
onReady() {
console.log("index page.js on ready invoke");
},
onShow() {
console.log("index page.js on show invoke");
},
onHide() {
console.log("index page.js on hide invoke");
},
onDestory() {
console.log("index page.js on destory invoke");
}
});
})();
} catch (e) {
console.log(e);
}
})();
} catch (e) {
console.log(e);
}