2020-03-15 00:04:46 +08:00
|
|
|
# 自定义内容
|
2019-10-23 23:08:29 +08:00
|
|
|
```html
|
2020-03-11 20:46:45 +08:00
|
|
|
<n-dynamic-input
|
2020-03-15 00:04:46 +08:00
|
|
|
v-model="customValue"
|
2020-03-17 15:31:28 +08:00
|
|
|
:on-create="onCreate"
|
|
|
|
:on-clear="onClear"
|
2019-10-23 23:08:29 +08:00
|
|
|
>
|
2020-03-15 00:04:46 +08:00
|
|
|
<template v-slot="{ value }">
|
|
|
|
<div style="width: 100%;">
|
|
|
|
<div style="display: flex; align-items: center;">
|
|
|
|
<n-checkbox
|
|
|
|
v-model="value.isCheck"
|
|
|
|
style="margin-right: 12px;"
|
|
|
|
/>
|
|
|
|
<n-input-number
|
|
|
|
v-model="value.num"
|
|
|
|
style="margin-right: 12px; width: 160px;"
|
|
|
|
/>
|
|
|
|
<n-input
|
|
|
|
v-model="value.string"
|
|
|
|
type="input"
|
|
|
|
/>
|
|
|
|
</div>
|
2019-10-23 23:08:29 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
2020-03-11 20:46:45 +08:00
|
|
|
</n-dynamic-input>
|
2020-03-09 12:12:31 +08:00
|
|
|
<pre>
|
2020-03-15 00:04:46 +08:00
|
|
|
{{ JSON.stringify(customValue, 0, 2) }}
|
2020-03-09 12:12:31 +08:00
|
|
|
</pre>
|
2019-10-23 23:08:29 +08:00
|
|
|
```
|
|
|
|
```js
|
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
2020-03-15 00:04:46 +08:00
|
|
|
customValue: [
|
2019-10-23 23:08:29 +08:00
|
|
|
{
|
2020-03-11 16:24:35 +08:00
|
|
|
isCheck: true,
|
|
|
|
num: 1,
|
2020-03-17 15:31:28 +08:00
|
|
|
string: '一个字符串'
|
2019-10-23 23:08:29 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2020-03-11 16:24:35 +08:00
|
|
|
},
|
|
|
|
methods: {
|
2020-03-17 15:31:28 +08:00
|
|
|
onCreate () {
|
2020-03-15 00:04:46 +08:00
|
|
|
return {
|
2020-03-11 16:24:35 +08:00
|
|
|
isCheck: false,
|
|
|
|
num: 1,
|
2020-03-17 15:31:28 +08:00
|
|
|
string: '一个字符串'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onClear () {
|
|
|
|
return {
|
|
|
|
isCheck: false,
|
|
|
|
num: 0,
|
|
|
|
string: ''
|
2020-03-15 00:04:46 +08:00
|
|
|
}
|
2020-03-11 16:24:35 +08:00
|
|
|
}
|
2019-10-23 23:08:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|