2020-03-09 09:29:48 +08:00
|
|
|
# 自定义
|
2019-10-23 23:08:29 +08:00
|
|
|
```html
|
2020-03-09 09:29:48 +08:00
|
|
|
<n-custom-add
|
2020-03-11 16:24:35 +08:00
|
|
|
v-model="test"
|
2019-10-23 23:08:29 +08:00
|
|
|
title="Add CheckBox"
|
2020-03-11 16:24:35 +08:00
|
|
|
preset="custom"
|
|
|
|
:onAdd="add"
|
2019-10-23 23:08:29 +08:00
|
|
|
>
|
|
|
|
<template v-slot="slotProps">
|
|
|
|
<div style="width:100%">
|
|
|
|
<n-checkbox
|
|
|
|
v-model="slotProps.item.isCheck"
|
|
|
|
style="width: 120px;"
|
|
|
|
/>
|
|
|
|
<n-input-number
|
|
|
|
v-model="slotProps.item.num"
|
|
|
|
/>
|
|
|
|
<n-input
|
|
|
|
v-model="slotProps.item.string"
|
|
|
|
type="input"
|
|
|
|
size="small"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</template>
|
2020-03-09 09:29:48 +08:00
|
|
|
</n-custom-add>
|
2020-03-09 12:12:31 +08:00
|
|
|
<pre>
|
|
|
|
{{ JSON.stringify(test,0,2) }}
|
|
|
|
</pre>
|
2019-10-23 23:08:29 +08:00
|
|
|
```
|
|
|
|
```js
|
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
2020-03-11 16:24:35 +08:00
|
|
|
test: [
|
2019-10-23 23:08:29 +08:00
|
|
|
{
|
2020-03-11 16:24:35 +08:00
|
|
|
isCheck: true,
|
|
|
|
num: 1,
|
|
|
|
string: 'Test string'
|
2019-10-23 23:08:29 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2020-03-11 16:24:35 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
add (resolve) {
|
|
|
|
resolve({
|
|
|
|
isCheck: false,
|
|
|
|
num: 1,
|
|
|
|
string: 'Test string'
|
|
|
|
})
|
|
|
|
}
|
2019-10-23 23:08:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|