2020-01-30 23:35:57 +08:00
|
|
|
# Use as a Component
|
2020-01-30 18:48:38 +08:00
|
|
|
Sometimes you may want to use a component.
|
2019-11-18 18:37:20 +08:00
|
|
|
```html
|
2019-12-06 17:44:58 +08:00
|
|
|
<n-confirm
|
|
|
|
title="Confirm"
|
|
|
|
content="Are you sure?"
|
|
|
|
:closable="false"
|
|
|
|
positive-text="submit"
|
|
|
|
@positive-click="cancelCallback"
|
|
|
|
@negative-click="submitCallback"
|
|
|
|
negative-text="cancel">
|
2019-11-18 18:37:20 +08:00
|
|
|
</n-confirm>
|
|
|
|
```
|
2019-12-06 17:44:58 +08:00
|
|
|
```js
|
|
|
|
export default {
|
|
|
|
methods: {
|
|
|
|
cancelCallback () {
|
|
|
|
this.$NMessage.success('cancel')
|
|
|
|
this.isActive = false
|
|
|
|
},
|
|
|
|
submitCallback () {
|
|
|
|
this.$NMessage.success('submit')
|
|
|
|
this.isActive = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
2019-11-18 18:37:20 +08:00
|
|
|
```css
|
|
|
|
.n-button {
|
|
|
|
margin: 0 12px 8px 0;
|
|
|
|
}
|
|
|
|
```
|