本文整理汇总了TypeScript中tns-core-modules/ui/dialogs.prompt函数的典型用法代码示例。如果您正苦于以下问题:TypeScript prompt函数的具体用法?TypeScript prompt怎么用?TypeScript prompt使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prompt函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test_DummyTestForSnippetOnly4
export function test_DummyTestForSnippetOnly4() {
// >> dialog-prompt
var options = {
title: "Name",
defaultText: "Enter your name",
inputType: dialogs.inputType.text
};
dialogs.prompt(options).then((result: dialogs.PromptResult) => {
console.log("Hello, " + result.text);
});
// << dialog-prompt
}
示例2: promptCapitalizationWords
public promptCapitalizationWords(args: observable.EventData) {
dialogs.prompt({
title: "Name",
message: "Enter name:",
cancelButtonText: "Cancel",
okButtonText: "OK",
inputType: dialogs.inputType.text,
capitalizationType: dialogs.capitalizationType.words
}).then((promptResult) => {
console.log("### Result: " + promptResult.result + ", Text: " + promptResult.text);
if (promptResult.result) {
this.set("name", promptResult.text);
}
else {
this.set("name", "Harold Finch");
}
});
}
示例3: promptText
public promptText(args: observable.EventData) {
dialogs.prompt({
title: "Name",
message: "Enter name:",
cancelButtonText: "Cancel",
neutralButtonText: "Ignore",
okButtonText: "OK",
defaultText: "John Reese",
inputType: dialogs.inputType.text
}).then((promptResult) => {
console.log("### Result: " + promptResult.result + ", Text: " + promptResult.text);
if (promptResult.result) {
this.set("name", promptResult.text);
}
else {
this.set("name", "Harold Finch");
}
});
}
示例4: promptNumber
public promptNumber(args: observable.EventData) {
dialogs.prompt({
title: "Name",
message: "Enter a number:",
cancelButtonText: "Cancel",
neutralButtonText: "Ignore",
okButtonText: "OK",
defaultText: "1234",
inputType: dialogs.inputType.number
}).then((promptResult) => {
console.log("### Result: " + promptResult.result + ", Text: " + promptResult.text);
if (promptResult.result) {
this.set("name", promptResult.text);
}
else {
this.set("name", "1234");
}
});
}