mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
21 lines
667 B
TypeScript
21 lines
667 B
TypeScript
import { Button } from "tns-core-modules/ui/button/button";
|
|
import { EventData } from "tns-core-modules/ui/page/page";
|
|
|
|
const states = [
|
|
{ class: "", text: "default elevation" },
|
|
{ class: "elevation-10", text: "elevetion 10" },
|
|
{ class: "elevation-10 pressed-z-10", text: "elevetion 10 pressed-z 10" },
|
|
{ class: "elevation-0", text: "elevetion 0" },
|
|
];
|
|
let currentState = 0;
|
|
|
|
export function buttonTap(args: EventData) {
|
|
let btn: Button = args.object as Button;
|
|
currentState++;
|
|
if (currentState >= states.length) {
|
|
currentState = 0;
|
|
}
|
|
btn.className = states[currentState].class;
|
|
btn.text = states[currentState].text;
|
|
}
|