Transfer
Examples
Size variants
Available ui
prop values: s
/ m
.
Available
- Infused
- Boiled
- Espresso
- Milk coffee
Selected
Available
- Infused
- Boiled
- Espresso
- Milk coffee
Selected
Selected: []
<template>
<article>
<section>
<veui-transfer
v-model="selected"
:datasource="coffees"
/>
</section>
<section>
<veui-transfer
v-model="selected"
:datasource="coffees"
ui="s"
/>
</section>
<p>Selected: {{ selected }}</p>
</article>
</template>
<script>
import { Transfer } from 'veui'
export default {
components: {
'veui-transfer': Transfer
},
data () {
return {
coffees: [
{
label: 'Infused',
value: 'infused',
children: [
{
label: 'Brewed',
value: 'brewed',
children: [
{
label: 'Drip brewed',
value: 'drip-brewed'
},
{
label: 'Filtered',
value: 'filtered'
},
{
label: 'Pour-over',
value: 'pour-over'
},
{
label: 'Immersion brewed',
value: 'immersion-brewed'
}
]
},
{
label: 'French press',
value: 'french-press'
},
{
label: 'Cold brew',
value: 'cold-brew'
}
]
},
{
label: 'Boiled',
value: 'boiled',
children: [
{
label: 'Percolated',
value: 'percolated'
},
{
label: 'Turkish',
value: 'turkish'
},
{
label: 'Moka',
value: 'moka'
}
]
},
{
label: 'Espresso',
value: 'espresso',
children: [
{
label: 'Caffè Americano',
value: 'caffe-americano'
},
{
label: 'Cafe Lungo',
value: 'cafe-lungo'
},
{
label: 'Café Cubano',
value: 'cafe-cubano'
},
{
label: 'Caffè crema',
value: 'caffe-crema'
},
{
label: 'Cafe Zorro',
value: 'cafe-zorro'
},
{
label: 'Doppio',
value: 'doppio'
},
{
label: 'Espresso Romano',
value: 'espresso-romano'
},
{
label: 'Guillermo',
value: 'guillermo'
},
{
label: 'Ristretto',
value: 'ristretto'
}
]
},
{
label: 'Milk coffee',
value: 'milk-coffee',
children: [
{
label: 'Flat white',
value: 'flat-white'
},
{
label: 'Latte',
value: 'latte'
},
{
label: 'Macchiato',
value: 'macchiato'
},
{
label: 'Cappuccino',
value: 'cappuccino'
},
{
label: 'White coffee',
value: 'white-coffee'
}
]
}
],
selected: []
}
}
}
</script>
<style lang="less" scoped>
section {
margin-bottom: 20px;
}
</style>
No search
Available
- Infused
- Boiled
- Espresso
- Milk coffee
Selected
Selected: []
<template>
<article>
<veui-transfer
v-model="selected"
:datasource="coffees"
:searchable="false"
/>
<p>Selected: {{ selected }}</p>
</article>
</template>
<script>
import { Transfer } from 'veui'
export default {
components: {
'veui-transfer': Transfer
},
data () {
return {
coffees: [
{
label: 'Infused',
value: 'infused',
children: [
{
label: 'Brewed',
value: 'brewed',
children: [
{
label: 'Drip brewed',
value: 'drip-brewed'
},
{
label: 'Filtered',
value: 'filtered'
},
{
label: 'Pour-over',
value: 'pour-over'
},
{
label: 'Immersion brewed',
value: 'immersion-brewed'
}
]
},
{
label: 'French press',
value: 'french-press'
},
{
label: 'Cold brew',
value: 'cold-brew'
}
]
},
{
label: 'Boiled',
value: 'boiled',
children: [
{
label: 'Percolated',
value: 'percolated'
},
{
label: 'Turkish',
value: 'turkish'
},
{
label: 'Moka',
value: 'moka'
}
]
},
{
label: 'Espresso',
value: 'espresso',
children: [
{
label: 'Caffè Americano',
value: 'caffe-americano'
},
{
label: 'Cafe Lungo',
value: 'cafe-lungo'
},
{
label: 'Café Cubano',
value: 'cafe-cubano'
},
{
label: 'Caffè crema',
value: 'caffe-crema'
},
{
label: 'Cafe Zorro',
value: 'cafe-zorro'
},
{
label: 'Doppio',
value: 'doppio'
},
{
label: 'Espresso Romano',
value: 'espresso-romano'
},
{
label: 'Guillermo',
value: 'guillermo'
},
{
label: 'Ristretto',
value: 'ristretto'
}
]
},
{
label: 'Milk coffee',
value: 'milk-coffee',
children: [
{
label: 'Flat white',
value: 'flat-white'
},
{
label: 'Latte',
value: 'latte'
},
{
label: 'Macchiato',
value: 'macchiato'
},
{
label: 'Cappuccino',
value: 'cappuccino'
},
{
label: 'White coffee',
value: 'white-coffee'
}
]
}
],
selected: []
}
}
}
</script>
Custom search
Available
- Infused
- Boiled
- Espresso
- Milk coffee
Selected
Selected: []
Customize filter
to filter by any of label
/ value
/ id
.
<template>
<article>
<veui-transfer
v-model="selected"
:datasource="coffees"
:filter="filter"
/>
<p>Selected: {{ selected }}</p>
</article>
</template>
<script>
import { Transfer } from 'veui'
import { includes } from 'lodash'
export default {
components: {
'veui-transfer': Transfer
},
data () {
return {
coffees: [
{
label: 'Infused',
value: 'infused',
id: '100',
children: [
{
label: 'Brewed',
value: 'brewed',
id: '100-01',
children: [
{
label: 'Drip brewed',
value: 'drip-brewed',
id: '100-01-01'
},
{
label: 'Filtered',
value: 'filtered',
id: '100-01-02'
},
{
label: 'Pour-over',
value: 'pour-over',
id: '100-01-03'
},
{
label: 'Immersion brewed',
value: 'immersion-brewed',
id: '100-01-04'
}
]
},
{
label: 'French press',
value: 'french-press',
id: '100-02'
},
{
label: 'Cold brew',
value: 'cold-brew',
id: '100-03'
}
]
},
{
label: 'Boiled',
value: 'boiled',
id: '200',
children: [
{
label: 'Percolated',
value: 'percolated',
id: '200-01'
},
{
label: 'Turkish',
value: 'turkish',
id: '200-02'
},
{
label: 'Moka',
value: 'moka',
id: '200-03'
}
]
},
{
label: 'Espresso',
value: 'espresso',
id: '300',
children: [
{
label: 'Caffè Americano',
value: 'caffe-americano',
id: '300-01'
},
{
label: 'Cafe Lungo',
value: 'cafe-lungo',
id: '300-02'
},
{
label: 'Café Cubano',
value: 'cafe-cubano',
id: '300-03'
},
{
label: 'Caffè crema',
value: 'caffe-crema',
id: '300-04'
},
{
label: 'Cafe Zorro',
value: 'cafe-zorro',
id: '300-05'
},
{
label: 'Doppio',
value: 'doppio',
id: '300-06'
},
{
label: 'Espresso Romano',
value: 'espresso-romano',
id: '300-07'
},
{
label: 'Guillermo',
value: 'guillermo',
id: '300-08'
},
{
label: 'Ristretto',
value: 'ristretto',
id: '300-09'
}
]
},
{
label: 'Milk coffee',
value: 'milk-coffee',
id: '400',
children: [
{
label: 'Flat white',
value: 'flat-white',
id: '400-01'
},
{
label: 'Latte',
value: 'latte',
id: '400-02'
},
{
label: 'Macchiato',
value: 'macchiato',
id: '400-03'
},
{
label: 'Cappuccino',
value: 'cappuccino',
id: '400-04'
},
{
label: 'White coffee',
value: 'white-coffee',
id: '400-05'
}
]
}
],
selected: []
}
},
methods: {
filter (type, keyword, { label, value, id }) {
let key = keyword.toLowerCase()
return (
includes(label.toLowerCase(), key) ||
includes(value.toLowerCase(), key) ||
includes(id, key)
)
}
}
}
</script>
Flat output
Available
- Infused
- Boiled
- Espresso
- Milk coffee
Selected
Selected: []
<template>
<article>
<veui-transfer
v-model="selected"
:datasource="coffees"
selected-show-mode="flat"
/>
<p>Selected: {{ selected }}</p>
</article>
</template>
<script>
import { Transfer } from 'veui'
export default {
components: {
'veui-transfer': Transfer
},
data () {
return {
coffees: [
{
label: 'Infused',
value: 'infused',
id: '100',
children: [
{
label: 'Brewed',
value: 'brewed',
id: '100-01',
children: [
{
label: 'Drip brewed',
value: 'drip-brewed',
id: '100-01-01'
},
{
label: 'Filtered',
value: 'filtered',
id: '100-01-02'
},
{
label: 'Pour-over',
value: 'pour-over',
id: '100-01-03'
},
{
label: 'Immersion brewed',
value: 'immersion-brewed',
id: '100-01-04'
}
]
},
{
label: 'French press',
value: 'french-press',
id: '100-02'
},
{
label: 'Cold brew',
value: 'cold-brew',
id: '100-03'
}
]
},
{
label: 'Boiled',
value: 'boiled',
id: '200',
children: [
{
label: 'Percolated',
value: 'percolated',
id: '200-01'
},
{
label: 'Turkish',
value: 'turkish',
id: '200-02'
},
{
label: 'Moka',
value: 'moka',
id: '200-03'
}
]
},
{
label: 'Espresso',
value: 'espresso',
id: '300',
children: [
{
label: 'Caffè Americano',
value: 'caffe-americano',
id: '300-01'
},
{
label: 'Cafe Lungo',
value: 'cafe-lungo',
id: '300-02'
},
{
label: 'Café Cubano',
value: 'cafe-cubano',
id: '300-03'
},
{
label: 'Caffè crema',
value: 'caffe-crema',
id: '300-04'
},
{
label: 'Cafe Zorro',
value: 'cafe-zorro',
id: '300-05'
},
{
label: 'Doppio',
value: 'doppio',
id: '300-06'
},
{
label: 'Espresso Romano',
value: 'espresso-romano',
id: '300-07'
},
{
label: 'Guillermo',
value: 'guillermo',
id: '300-08'
},
{
label: 'Ristretto',
value: 'ristretto',
id: '300-09'
}
]
},
{
label: 'Milk coffee',
value: 'milk-coffee',
id: '400',
children: [
{
label: 'Flat white',
value: 'flat-white',
id: '400-01'
},
{
label: 'Latte',
value: 'latte',
id: '400-02'
},
{
label: 'Macchiato',
value: 'macchiato',
id: '400-03'
},
{
label: 'Cappuccino',
value: 'cappuccino',
id: '400-04'
},
{
label: 'White coffee',
value: 'white-coffee',
id: '400-05'
}
]
}
],
selected: []
}
}
}
</script>
Merge modes
Set the merge-checked
prop to specify the merge mode for selected values.
Available
- Infused
- Boiled
- Espresso
- Milk coffee
Selected
Selected: []
<template>
<article>
<section>
<veui-radio-group
v-model="mergeChecked"
class="group"
:items="items"
/>
<veui-transfer
v-model="selected"
:datasource="coffees"
:merge-checked="mergeChecked"
/>
<p>Selected: {{ selected }}</p>
</section>
</article>
</template>
<script>
import { Transfer, RadioGroup } from 'veui'
export default {
components: {
'veui-transfer': Transfer,
'veui-radio-group': RadioGroup
},
data () {
return {
coffees: [
{
label: 'Infused',
value: 'infused',
id: '100',
children: [
{
label: 'Brewed',
value: 'brewed',
id: '100-01',
children: [
{
label: 'Drip brewed',
value: 'drip-brewed',
id: '100-01-01'
},
{
label: 'Filtered',
value: 'filtered',
id: '100-01-02'
},
{
label: 'Pour-over',
value: 'pour-over',
id: '100-01-03'
},
{
label: 'Immersion brewed',
value: 'immersion-brewed',
id: '100-01-04'
}
]
},
{
label: 'French press',
value: 'french-press',
id: '100-02'
},
{
label: 'Cold brew',
value: 'cold-brew',
id: '100-03'
}
]
},
{
label: 'Boiled',
value: 'boiled',
id: '200',
children: [
{
label: 'Percolated',
value: 'percolated',
id: '200-01'
},
{
label: 'Turkish',
value: 'turkish',
id: '200-02'
},
{
label: 'Moka',
value: 'moka',
id: '200-03'
}
]
},
{
label: 'Espresso',
value: 'espresso',
id: '300',
children: [
{
label: 'Caffè Americano',
value: 'caffe-americano',
id: '300-01'
},
{
label: 'Cafe Lungo',
value: 'cafe-lungo',
id: '300-02'
},
{
label: 'Café Cubano',
value: 'cafe-cubano',
id: '300-03'
},
{
label: 'Caffè crema',
value: 'caffe-crema',
id: '300-04'
},
{
label: 'Cafe Zorro',
value: 'cafe-zorro',
id: '300-05'
},
{
label: 'Doppio',
value: 'doppio',
id: '300-06'
},
{
label: 'Espresso Romano',
value: 'espresso-romano',
id: '300-07'
},
{
label: 'Guillermo',
value: 'guillermo',
id: '300-08'
},
{
label: 'Ristretto',
value: 'ristretto',
id: '300-09'
}
]
},
{
label: 'Milk coffee',
value: 'milk-coffee',
id: '400',
children: [
{
label: 'Flat white',
value: 'flat-white',
id: '400-01'
},
{
label: 'Latte',
value: 'latte',
id: '400-02'
},
{
label: 'Macchiato',
value: 'macchiato',
id: '400-03'
},
{
label: 'Cappuccino',
value: 'cappuccino',
id: '400-04'
},
{
label: 'White coffee',
value: 'white-coffee',
id: '400-05'
}
]
}
],
mergeChecked: 'keep-all',
selected: []
}
},
computed: {
items () {
return [
{ label: 'keep-all', value: 'keep-all' },
{ label: 'downwards', value: 'downwards' },
{ label: 'upwards', value: 'upwards' }
]
}
}
}
</script>
<style lang="less" scoped>
.group {
margin-bottom: 20px;
}
</style>
API
Props
Name | Type | Default | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ui | string | - | Predefined styles.
| ||||||||||||||||||
datasource | Array<Object> | [] | Data source array, each item type is
| ||||||||||||||||||
searchable | boolean | true | Whether to enable search. | ||||||||||||||||||
filter | function | See description | Search filter function, with signature
| ||||||||||||||||||
selected | Array | [] |
The currently selected values, which are the | ||||||||||||||||||
candidate-placeholder | string | - | Placeholder text for the search box in the candidate area. | ||||||||||||||||||
selected-placeholder | string | - | Placeholder text for the search box in the selected area. | ||||||||||||||||||
candidate-title | string | - | The text content of the "candidate options" title. | ||||||||||||||||||
selected-title | string | - | The text content of the "selected options" title. | ||||||||||||||||||
selected-show-mode | string | 'tree' | The display mode for selected items in the select box.
| ||||||||||||||||||
keys | string | function | 'value' | Customize how to obtain the If the type is | ||||||||||||||||||
merge-checked | string | keep-all | The merge strategy for selected values. When all child nodes under a node are selected, you can choose to keep only the parent node, only the child nodes, or both.
|
Slots
Name | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
candidate | The entire candidate area. | |||||||||||||||||||||
candidate-head | The title area at the top of the candidate area.
| |||||||||||||||||||||
selected-head | The title area at the top of the selected area.
| |||||||||||||||||||||
candidate-title | The text area of the title at the top of the candidate area. Slot props are the same as candidate-head . | |||||||||||||||||||||
selected-title | The text area of the title at the top of the selected area. Slot props are the same as selected-head . | |||||||||||||||||||||
candidate-no-data | The content displayed when there is no data in the data source. | |||||||||||||||||||||
selected-no-data | The content displayed when there are no selected items. | |||||||||||||||||||||
candidate-item | The content of each item in the candidate area.
| |||||||||||||||||||||
selected-item | The content of each item in the selected area. If the
| |||||||||||||||||||||
candidate-item-label | The text area of each item in the candidate area. Slot props are the same as candidate-item . | |||||||||||||||||||||
selected-item-label | The text area of each item in the selected area. When selected-show-mode is 'tree' , slot parameters are the same as selected-item . Otherwise, this slot corresponds to the content of each node on the entire path of each selected leaf item, and the slot parameters are the same as candidate-item . |
Events
Name | Description |
---|---|
select | Triggered when the selection is toggled. The callback parameter is (selected: Array<string>) . selected is the collection of the value field of the selected items. |
Icons
Name | Description |
---|---|
checked | Selected state. |
select | To be selected. |
remove | Remove. |
expand | Collapsed state, click to expand. |
collapse | Expanded state, click to collapse. |
separator | The separator between levels when selected-show-mode is 'flat' . |