本文整理匯總了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");
}
});
}