2020-02-04 14:55:55 +08:00
|
|
|
# 基础用法
|
|
|
|
Modal 的基础用法,你可以把任何东西放进去,比如一个卡片。
|
|
|
|
```html
|
|
|
|
<n-button
|
2020-03-20 12:14:34 +08:00
|
|
|
@click="modalActive = true"
|
2020-02-04 14:55:55 +08:00
|
|
|
>
|
2020-03-05 13:45:45 +08:00
|
|
|
来吧
|
2020-02-04 14:55:55 +08:00
|
|
|
</n-button>
|
2020-03-20 12:14:34 +08:00
|
|
|
<n-modal v-model="modalActive">
|
2020-02-04 14:55:55 +08:00
|
|
|
<n-card
|
|
|
|
style="width: 600px;"
|
|
|
|
title="模态框"
|
|
|
|
:bordered="false"
|
|
|
|
size="huge"
|
|
|
|
:segmented="{
|
|
|
|
content: 'soft',
|
|
|
|
footer: 'soft'
|
|
|
|
}"
|
|
|
|
>
|
|
|
|
<template v-slot:header-extra>
|
|
|
|
噢!
|
|
|
|
</template>
|
|
|
|
内容
|
|
|
|
<template v-slot:footer>
|
|
|
|
尾部
|
|
|
|
</template>
|
|
|
|
</n-card>
|
|
|
|
</n-modal>
|
|
|
|
```
|
|
|
|
```js
|
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
2020-03-20 12:14:34 +08:00
|
|
|
modalActive: false
|
2020-02-04 14:55:55 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|