mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-23 09:01:10 +08:00
26 lines
900 B
TypeScript
26 lines
900 B
TypeScript
import { EventData, TextBase, TextDecoration } from "ui/text-base";
|
|
|
|
const possibleValues = [
|
|
TextDecoration.NONE,
|
|
TextDecoration.UNDERLINE,
|
|
TextDecoration.LINE_THROUGH,
|
|
TextDecoration.UNDERLINE_LINE_THROUGH
|
|
];
|
|
|
|
export function butonTap(args: EventData) {
|
|
let page = (<TextBase>args.object).page;
|
|
let lbl = <TextBase>page.getViewById("Label");
|
|
let btn = <TextBase>page.getViewById("Button");
|
|
let textField = <TextBase>page.getViewById("TextField");
|
|
let textView = <TextBase>page.getViewById("TextView");
|
|
|
|
let currentIndex = possibleValues.indexOf(lbl.textDecoration);
|
|
let newIndex = (currentIndex + 1) % possibleValues.length;
|
|
let newValue = <TextDecoration>possibleValues[newIndex];
|
|
|
|
lbl.textDecoration = newValue;
|
|
btn.textDecoration = newValue;
|
|
textField.textDecoration = newValue;
|
|
textView.textDecoration = newValue;
|
|
}
|