-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7cb5b4
commit e9a68a6
Showing
6 changed files
with
133 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/docs/src/examples/v-confirm-directive/object-literals.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<template> | ||
<div class="text-center py-10"> | ||
<v-btn text="Confirm" v-confirm="confirm"></v-btn> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
const confirm = { | ||
text: 'Are you sure?', | ||
onSubmit () { | ||
alert('Confirmed!') | ||
}, | ||
} | ||
</script> | ||
|
||
<script> | ||
export default { | ||
data: () => ({ | ||
text: 'Are you sure?', | ||
scrollStrategy: 'block', | ||
}), | ||
methods: { | ||
onSubmit () { | ||
alert('Confirmed!') | ||
}, | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<template> | ||
<ExamplesUsageExample | ||
v-model="model" | ||
:code="code" | ||
:name="name" | ||
:options="options" | ||
> | ||
<div class="text-center"> | ||
<v-btn | ||
v-if="!showInput" | ||
text="Save Change" | ||
v-confirm="{ text: 'Are you sure?', onSubmit }" | ||
></v-btn> | ||
<v-btn | ||
v-else | ||
text="Change name" | ||
v-confirm="{ text: 'Enter name', input, onSubmit }" | ||
></v-btn> | ||
</div> | ||
|
||
<template v-slot:configuration> | ||
<v-text-field v-model="text" label="Text"></v-text-field> | ||
<v-checkbox v-model="showInput" label="Show Input"></v-checkbox> | ||
</template> | ||
</ExamplesUsageExample> | ||
</template> | ||
|
||
<script setup> | ||
const name = 'v-confirm' | ||
const model = ref('default') | ||
const text = ref('Are you sure?') | ||
const showInput = ref(false) | ||
const input = ref('John') | ||
const code = computed(() => { | ||
return !showInput.value ? `<v-btn v-confirm="{ text:'Are you sure?', onSubmit: () => alert('Submit clicked')}">Save Change</v-btn>` | ||
: `<v-btn v-confirm="{ text:'Enter name', input: 'John', onSubmit: (value) => alert(value)}">Change name</v-btn>` | ||
}) | ||
const onSubmit = value => { | ||
alert(value || 'Submit clicked') | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
emphasized: true | ||
meta: | ||
nav: Confirm | ||
title: Confirm directive | ||
description: The Confirm directive is an easy to use implementation of VConfirm. | ||
keywords: Confirm, vuetify Confirm directive, vue Confirm directive, mobile Confirm directive | ||
related: | ||
- /components/menu/ | ||
- /components/list/ | ||
- /components/text-field/ | ||
features: | ||
report: true | ||
--- | ||
|
||
# Confirm directive | ||
|
||
The `v-confirm` directive is a shorthand way of adding confirms in your application. | ||
|
||
<PageFeatures /> | ||
|
||
<PromotedEntry /> | ||
|
||
## Usage | ||
|
||
The `v-confirm` directive makes it easy to add a confirm to any element in your application. It is a wrapper around the `v-confirm` component. | ||
|
||
<ExamplesUsage name="v-confirm-directive" /> | ||
|
||
## API | ||
|
||
| Props | Type | | ||
|--------------------------------------------|-------------------------------------| | ||
| title | String | | ||
| text | String | | ||
| input | String, Boolean | | ||
| inputProps | [v-text-field](/api/v-text-field/) | | ||
| onSubmit | ((value: any) => void) | | ||
| onCancel | (() => number) | | ||
|
||
|
||
## Guide | ||
|
||
The `v-confirm` directive is a simple way to add a confirm to any element in your application. It is a wrapper around the `v-confirm`. | ||
|
||
### Object literals | ||
|
||
The `v-confirm` directive can also accept an object literal as a value. This is useful when you need to pass multiple props to the `v-confirm` component. | ||
|
||
<ExamplesExample file="v-confirm-directive/object-literals" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export { ClickOutside } from './click-outside' | ||
// export { Color } from './color' | ||
export { Confirm } from './confirm' | ||
export { Intersect } from './intersect' | ||
export { Mutate } from './mutate' | ||
export { Resize } from './resize' | ||
export { Ripple } from './ripple' | ||
export { Scroll } from './scroll' | ||
export { Touch } from './touch' | ||
export { Tooltip } from './tooltip' | ||
export { Confirm } from './confirm' |