naive-ui/demo/documentation/components/modal/enUS/presetConfirm.md

38 lines
666 B
Markdown
Raw Normal View History

2019-11-15 17:44:43 +08:00
# Use Preset Confirm
2020-01-30 22:45:44 +08:00
An example of preset `confirm`.
2019-11-13 11:40:32 +08:00
```html
<n-button
@click="isActive = true"
>
Start Me up
</n-button>
<n-modal v-model="isActive"
preset="confirm"
2020-02-04 14:55:55 +08:00
title="Confirm"
content="Are you sure?"
2019-11-13 11:40:32 +08:00
:closable="false"
2020-02-04 14:55:55 +08:00
positive-text="Submit"
@positive-click="submitCallback"
@negative-click="cancelCallback"
negative-text="Cancel"
2020-01-30 22:45:44 +08:00
/>
2019-11-13 11:40:32 +08:00
```
```js
export default {
data () {
return {
isActive: false,
}
},
methods: {
cancelCallback () {
2020-02-04 14:55:55 +08:00
this.$NMessage.success('Cancel')
2019-11-13 11:40:32 +08:00
this.isActive = false
},
submitCallback () {
2020-02-04 14:55:55 +08:00
this.$NMessage.success('Submit')
2019-11-13 11:40:32 +08:00
this.isActive = false
}
}
}
```