mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
refactor(examples): remove dedicated dialog example (#343)
This commit is contained in:
committed by
GitHub
parent
5015132ece
commit
02754f527c
@@ -56,7 +56,7 @@
|
||||
component: Cli,
|
||||
icon: 'i-codicon-terminal'
|
||||
},
|
||||
!isMobile && {
|
||||
{
|
||||
label: 'Dialog',
|
||||
component: Dialog,
|
||||
icon: 'i-codicon-multiple-windows'
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user