稍微优雅的使用Skylint引擎与GlassEasel组件,项目地址在
https://gitee.com/ngaiwa/kuak.git
做了一些语法兼容处理。
// index.ts
(class Home extends Page.Base {
data!: TData<{ clickTip: string; count: number }>;
static dataObservers = {
count(this: Home, count: number) {
this.setData({ clickTip: `点击了${count}次` });
},
};
onCreate() {
this.initData({ clickTip: '', count: 0 });
}
onLoad() {
this.addEventListener('addClick', console.log);
}
onShow() {
console.log('show');
}
onClick() {
this.setData({ count: this.data.count + 1 });
this.dispatchEvent('addClick', this.data);
}
}).register();
<!--index.wxml-->
<view class="container">
<view bind:tap="onClick">Kuak {{clickTip}}</view>
</view>
加油