mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 05:18:39 +08:00
39 lines
902 B
TypeScript
39 lines
902 B
TypeScript
import { EventData } from "data/observable";
|
|
import { Page } from "ui/page";
|
|
import observable = require("data/observable");
|
|
|
|
export function navigatingTo(args: EventData) {
|
|
let page = <Page>args.object;
|
|
page.bindingContext = new ActionItemPostitionView();
|
|
}
|
|
|
|
export class ActionItemPostitionView extends observable.Observable {
|
|
private _values = ["-i---", "---i---", "---i-"];
|
|
private _count: number;
|
|
private _text: string;
|
|
|
|
constructor() {
|
|
super();
|
|
this._count = 0;
|
|
}
|
|
|
|
get text(): string {
|
|
return this._text;
|
|
}
|
|
|
|
set text(value: string) {
|
|
if (this._text !== value) {
|
|
this._text = value;
|
|
this.notifyPropertyChange("text", value)
|
|
}
|
|
}
|
|
|
|
public onTap() {
|
|
this.change();
|
|
}
|
|
|
|
public change() {
|
|
let index = this._count++ % 3;
|
|
this.text = this._values[index];
|
|
}
|
|
} |