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"
|
2020-02-05 23:49:59 +08:00
|
|
|
negative-text="Cancel"
|
2020-02-04 13:23:36 +08:00
|
|
|
positive-text="Submit"
|
2020-02-05 23:49:59 +08:00
|
|
|
@positive-click="handlePositiveClick"
|
|
|
|
@negative-click="handleNegativeClick"
|
|
|
|
/>
|
2019-11-18 18:37:20 +08:00
|
|
|
```
|
2019-12-06 17:44:58 +08:00
|
|
|
```js
|
|
|
|
export default {
|
|
|
|
methods: {
|
2020-02-05 23:49:59 +08:00
|
|
|
handleNegativeClick () {
|
2020-02-04 13:23:36 +08:00
|
|
|
this.$NMessage.waning('Cancel')
|
2019-12-06 17:44:58 +08:00
|
|
|
this.isActive = false
|
|
|
|
},
|
2020-02-05 23:49:59 +08:00
|
|
|
handlePositiveClick () {
|
|
|
|
this.$NMessage.success('Confirm')
|
2019-12-06 17:44:58 +08:00
|
|
|
this.isActive = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
2019-11-18 18:37:20 +08:00
|
|
|
```css
|
|
|
|
.n-button {
|
|
|
|
margin: 0 12px 8px 0;
|
|
|
|
}
|
|
|
|
```
|