refactor(examples): remove dedicated dialog example (#343)

This commit is contained in:
Lucas Fernandes Nogueira
2023-05-06 08:27:53 -07:00
committed by GitHub
parent 5015132ece
commit 02754f527c
100 changed files with 17 additions and 6529 deletions
+4
View File
@@ -3677,11 +3677,15 @@ version = "0.1.0"
dependencies = [
"log",
"notify-rust",
"rand 0.8.5",
"serde",
"serde_json",
"serde_repr",
"tauri",
"tauri-build",
"thiserror",
"time",
"url",
"win7-notifications",
]
+1 -1
View File
@@ -56,7 +56,7 @@
component: Cli,
icon: 'i-codicon-terminal'
},
!isMobile && {
{
label: 'Dialog',
component: Dialog,
icon: 'i-codicon-multiple-windows'
+12 -1
View File
@@ -1,5 +1,5 @@
<script>
import { open, save } from 'tauri-plugin-dialog-api'
import { open, save, confirm } from 'tauri-plugin-dialog-api'
import { readBinaryFile } from 'tauri-plugin-fs-api'
export let onMessage
@@ -21,6 +21,16 @@
reader.readAsDataURL(blob)
}
async function prompt() {
confirm('Is Tauri awesome?', {
okLabel: 'Absolutely',
cancelLabel: 'Totally',
}).then(res => onMessage(res
? "Tauri is absolutely awesome"
: "Tauri is totally awesome"
)).catch(onMessage)
}
function openDialog() {
open({
title: 'My wonderful open dialog',
@@ -116,3 +126,4 @@
<button class="btn" id="save-dialog" on:click={saveDialog}
>Open save dialog</button
>
<button class="btn" id="prompt-dialog" on:click={prompt}>Prompt</button>