2020-02-04 14:55:55 +08:00
|
|
|
# 使用 Confirm 预设
|
|
|
|
`confirm` 预设的例子。
|
|
|
|
```html
|
|
|
|
<n-button
|
|
|
|
@click="isActive = true"
|
|
|
|
>
|
2020-03-05 13:45:45 +08:00
|
|
|
来吧
|
2020-02-04 14:55:55 +08:00
|
|
|
</n-button>
|
|
|
|
<n-modal v-model="isActive"
|
|
|
|
preset="confirm"
|
|
|
|
title="确认"
|
|
|
|
content="你确认?"
|
|
|
|
:closable="false"
|
|
|
|
positive-text="确认"
|
|
|
|
@positive-click="submitCallback"
|
|
|
|
@negative-click="cancelCallback"
|
|
|
|
negative-text="算了"
|
|
|
|
/>
|
|
|
|
```
|
|
|
|
```js
|
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
isActive: false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
cancelCallback () {
|
|
|
|
this.$NMessage.success('算了')
|
|
|
|
this.isActive = false
|
|
|
|
},
|
|
|
|
submitCallback () {
|
|
|
|
this.$NMessage.success('确认')
|
|
|
|
this.isActive = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|