|
@@ -52,7 +52,8 @@
|
|
|
value1: [1, 4],
|
|
|
value2: [],
|
|
|
value3: [1],
|
|
|
- value4: [],
|
|
|
+ value4: [1],
|
|
|
+ value5: [],
|
|
|
filterMethod(query, item) {
|
|
|
return item.initial.toLowerCase().indexOf(query.toLowerCase()) > -1;
|
|
|
},
|
|
@@ -155,26 +156,51 @@ You can search and filter data items.
|
|
|
|
|
|
You can customize list titles, button texts, render function for data items, checking status texts in list footer and list footer contents.
|
|
|
|
|
|
-:::demo Use `titles`, `button-texts`, `render-content` and `format` to respectively customize list titles, button texts, render function for data items, checking status texts in list header. For list footer contents, two named slots are provided: `left-footer` and `right-footer`. Plus, if you want some items initially checked, you can use `left-default-checked` and `right-default-checked`. Finally, this example demonstrate the `change` event. Note that this demo can't run in jsfiddle because it doesn't support JSX syntax. In a real project, `render-content` will work if relevant dependencies are correctly configured.
|
|
|
+:::demo Use `titles`, `button-texts`, `render-content` and `format` to respectively customize list titles, button texts, render function for data items, checking status texts in list header. Plus, you can also use scoped slot to customize data items. For list footer contents, two named slots are provided: `left-footer` and `right-footer`. Plus, if you want some items initially checked, you can use `left-default-checked` and `right-default-checked`. Finally, this example demonstrate the `change` event. Note that this demo can't run in jsfiddle because it doesn't support JSX syntax. In a real project, `render-content` will work if relevant dependencies are correctly configured.
|
|
|
```html
|
|
|
<template>
|
|
|
- <el-transfer
|
|
|
- v-model="value3"
|
|
|
- filterable
|
|
|
- :left-default-checked="[2, 3]"
|
|
|
- :right-default-checked="[1]"
|
|
|
- :render-content="renderFunc"
|
|
|
- :titles="['Source', 'Target']"
|
|
|
- :button-texts="['To left', 'To right']"
|
|
|
- :format="{
|
|
|
- noChecked: '${total}',
|
|
|
- hasChecked: '${checked}/${total}'
|
|
|
- }"
|
|
|
- @change="handleChange"
|
|
|
- :data="data">
|
|
|
- <el-button class="transfer-footer" slot="left-footer" size="small">Operation</el-button>
|
|
|
- <el-button class="transfer-footer" slot="right-footer" size="small">Operation</el-button>
|
|
|
- </el-transfer>
|
|
|
+ <p style="text-align: center; margin: 0 0 20px">Customize data items using render-content</p>
|
|
|
+ <div style="text-align: center">
|
|
|
+ <el-transfer
|
|
|
+ style="text-align: left; display: inline-block"
|
|
|
+ v-model="value3"
|
|
|
+ filterable
|
|
|
+ :left-default-checked="[2, 3]"
|
|
|
+ :right-default-checked="[1]"
|
|
|
+ :render-content="renderFunc"
|
|
|
+ :titles="['Source', 'Target']"
|
|
|
+ :button-texts="['To left', 'To right']"
|
|
|
+ :format="{
|
|
|
+ noChecked: '${total}',
|
|
|
+ hasChecked: '${checked}/${total}'
|
|
|
+ }"
|
|
|
+ @change="handleChange"
|
|
|
+ :data="data">
|
|
|
+ <el-button class="transfer-footer" slot="left-footer" size="small">Operation</el-button>
|
|
|
+ <el-button class="transfer-footer" slot="right-footer" size="small">Operation</el-button>
|
|
|
+ </el-transfer>
|
|
|
+ <p style="text-align: center; margin: 50px 0 20px">Customize data items using scoped slot</p>
|
|
|
+ <div style="text-align: center">
|
|
|
+ <el-transfer
|
|
|
+ style="text-align: left; display: inline-block"
|
|
|
+ v-model="value4"
|
|
|
+ filterable
|
|
|
+ :left-default-checked="[2, 3]"
|
|
|
+ :right-default-checked="[1]"
|
|
|
+ :titles="['Source', 'Target']"
|
|
|
+ :button-texts="['To left', 'To right']"
|
|
|
+ :format="{
|
|
|
+ noChecked: '${total}',
|
|
|
+ hasChecked: '${checked}/${total}'
|
|
|
+ }"
|
|
|
+ @change="handleChange"
|
|
|
+ :data="data">
|
|
|
+ <span slot-scope="{ option }">{{ option.key }} - {{ option.label }}</span>
|
|
|
+ <el-button class="transfer-footer" slot="left-footer" size="small">Operation</el-button>
|
|
|
+ <el-button class="transfer-footer" slot="right-footer" size="small">Operation</el-button>
|
|
|
+ </el-transfer>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<style>
|
|
@@ -201,6 +227,7 @@ You can customize list titles, button texts, render function for data items, che
|
|
|
return {
|
|
|
data: generateData(),
|
|
|
value3: [1],
|
|
|
+ value4: [1],
|
|
|
renderFunc(h, option) {
|
|
|
return <span>{ option.key } - { option.label }</span>;
|
|
|
}
|
|
@@ -224,7 +251,7 @@ By default, Transfer looks for `key`, `label` and `disabled` in a data item. If
|
|
|
```html
|
|
|
<template>
|
|
|
<el-transfer
|
|
|
- v-model="value4"
|
|
|
+ v-model="value5"
|
|
|
:props="{
|
|
|
key: 'value',
|
|
|
label: 'desc'
|
|
@@ -249,7 +276,7 @@ By default, Transfer looks for `key`, `label` and `disabled` in a data item. If
|
|
|
};
|
|
|
return {
|
|
|
data3: generateData3(),
|
|
|
- value4: []
|
|
|
+ value5: []
|
|
|
};
|
|
|
}
|
|
|
};
|
|
@@ -279,6 +306,11 @@ By default, Transfer looks for `key`, `label` and `disabled` in a data item. If
|
|
|
| left-footer | content of left list footer |
|
|
|
| right-footer | content of right list footer |
|
|
|
|
|
|
+### Scoped Slot
|
|
|
+| Name | Description |
|
|
|
+|------|--------|
|
|
|
+| — | Custom content for data items. The scope parameter is { option } |
|
|
|
+
|
|
|
### Methods
|
|
|
| Method | Description | Parameters |
|
|
|
| ---- | ---- | ---- |
|