naive-ui/demo/documentation/components/confirm/enUS/useComponent.md

32 lines
584 B
Markdown
Raw Normal View History

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"
negative-text="Cancel"
2020-02-04 13:23:36 +08:00
positive-text="Submit"
@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: {
handleNegativeClick () {
2020-02-04 13:23:36 +08:00
this.$NMessage.waning('Cancel')
2019-12-06 17:44:58 +08:00
this.isActive = false
},
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;
}
```