mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
32 lines
584 B
Markdown
32 lines
584 B
Markdown
# Use as a Component
|
|
Sometimes you may want to use a component.
|
|
```html
|
|
<n-confirm
|
|
title="Confirm"
|
|
content="Are you sure?"
|
|
:closable="false"
|
|
negative-text="Cancel"
|
|
positive-text="Submit"
|
|
@positive-click="handlePositiveClick"
|
|
@negative-click="handleNegativeClick"
|
|
/>
|
|
```
|
|
```js
|
|
export default {
|
|
methods: {
|
|
handleNegativeClick () {
|
|
this.$NMessage.waning('Cancel')
|
|
this.isActive = false
|
|
},
|
|
handlePositiveClick () {
|
|
this.$NMessage.success('Confirm')
|
|
this.isActive = false
|
|
}
|
|
}
|
|
}
|
|
```
|
|
```css
|
|
.n-button {
|
|
margin: 0 12px 8px 0;
|
|
}
|
|
``` |