2019-10-25 12:59:50 +08:00
|
|
|
# Basic
|
|
|
|
```html
|
|
|
|
<n-transfer
|
|
|
|
ref="transfer"
|
|
|
|
v-model="value"
|
|
|
|
:options="options"
|
|
|
|
/>
|
|
|
|
<n-button @click="regenOptions">
|
|
|
|
Regen Options
|
|
|
|
</n-button>
|
|
|
|
<n-button @click="regenValues">
|
|
|
|
Regen Values
|
|
|
|
</n-button>
|
2020-01-18 13:28:20 +08:00
|
|
|
<!-- <pre class="n-doc-section__inspect">{{ JSON.stringify(value) }}</pre>
|
|
|
|
<pre class="n-doc-section__inspect">{{ $refs.transfer ? $refs.transfer.memorizedSourceOptions.map(option => option.value) : null }}</pre>
|
|
|
|
<pre class="n-doc-section__inspect">{{ $refs.transfer ? $refs.transfer.targetOptions.map(option => option.value) : null }}</pre> -->
|
2019-10-25 12:59:50 +08:00
|
|
|
```
|
|
|
|
```js
|
|
|
|
let prefix = null
|
|
|
|
|
|
|
|
function genOptions () {
|
|
|
|
prefix = Math.random().toString(36).slice(2, 5)
|
2020-01-18 13:28:20 +08:00
|
|
|
return Array.apply(null, { length: 1000 }).map((v, i) => ({
|
2019-10-25 12:59:50 +08:00
|
|
|
label: prefix + 'Option' + i,
|
|
|
|
value: prefix + i,
|
2020-01-18 13:28:20 +08:00
|
|
|
disabled: i % 5 === 0
|
2019-10-25 12:59:50 +08:00
|
|
|
}))
|
|
|
|
}
|
|
|
|
|
|
|
|
function genValues () {
|
2020-01-18 13:28:20 +08:00
|
|
|
return Array.apply(null, { length: 500 }).map((v, i) => prefix + i)
|
2019-10-25 12:59:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
options: genOptions(),
|
|
|
|
value: genValues()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted () {
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
regenOptions () {
|
|
|
|
this.options = genOptions()
|
|
|
|
},
|
|
|
|
regenValues () {
|
|
|
|
this.value = genValues()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|