Commit 2dc6888278ad9d4037f21d4c9df8ca31393e67dc
1 parent
c736b0f1
fix #4938
Showing
2 changed files
with
56 additions
and
68 deletions
Show diff stats
examples/routers/select.vue
| 1 | 1 | <template> |
| 2 | - <Row> | |
| 3 | - <Col span="12" style="padding-right:10px"> | |
| 4 | - <Select | |
| 5 | - v-model="model13" | |
| 6 | - filterable | |
| 7 | - remote | |
| 8 | - :remote-method="remoteMethod1" | |
| 9 | - :loading="loading1"> | |
| 10 | - <Option v-for="(option, index) in options1" :value="option.value" :key="index">{{option.label}}</Option> | |
| 2 | + <div style="margin: 200px;"> | |
| 3 | + <Select size="small" v-model="model10" multiple style="width:260px"> | |
| 4 | + <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option> | |
| 11 | 5 | </Select> |
| 12 | - </Col> | |
| 13 | - <Col span="12"> | |
| 14 | - <Select | |
| 15 | - v-model="model14" | |
| 16 | - multiple | |
| 17 | - filterable | |
| 18 | - remote | |
| 19 | - :remote-method="remoteMethod2" | |
| 20 | - :loading="loading2"> | |
| 21 | - <Option v-for="(option, index) in options2" :value="option.value" :key="index">{{option.label}}</Option> | |
| 6 | + <Select v-model="model10" multiple style="width:260px"> | |
| 7 | + <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option> | |
| 22 | 8 | </Select> |
| 23 | - </Col> | |
| 24 | - </Row> | |
| 9 | + <Select size="large" v-model="model10" multiple style="width:260px"> | |
| 10 | + <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option> | |
| 11 | + </Select> | |
| 12 | + </div> | |
| 25 | 13 | </template> |
| 26 | 14 | <script> |
| 27 | 15 | export default { |
| 28 | 16 | data () { |
| 29 | 17 | return { |
| 30 | - model13: '', | |
| 31 | - loading1: false, | |
| 32 | - options1: [], | |
| 33 | - model14: [], | |
| 34 | - loading2: false, | |
| 35 | - options2: [], | |
| 36 | - list: ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New hampshire', 'New jersey', 'New mexico', 'New york', 'North carolina', 'North dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode island', 'South carolina', 'South dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West virginia', 'Wisconsin', 'Wyoming'] | |
| 37 | - } | |
| 38 | - }, | |
| 39 | - methods: { | |
| 40 | - remoteMethod1 (query) { | |
| 41 | - if (query !== '') { | |
| 42 | - this.loading1 = true; | |
| 43 | - setTimeout(() => { | |
| 44 | - this.loading1 = false; | |
| 45 | - const list = this.list.map(item => { | |
| 46 | - return { | |
| 47 | - value: item, | |
| 48 | - label: item | |
| 49 | - }; | |
| 50 | - }); | |
| 51 | - this.options1 = list.filter(item => item.label.toLowerCase().indexOf(query.toLowerCase()) > -1); | |
| 52 | - }, 200); | |
| 53 | - } else { | |
| 54 | - this.options1 = []; | |
| 55 | - } | |
| 56 | - }, | |
| 57 | - remoteMethod2 (query) { | |
| 58 | - if (query !== '') { | |
| 59 | - this.loading2 = true; | |
| 60 | - setTimeout(() => { | |
| 61 | - this.loading2 = false; | |
| 62 | - const list = this.list.map(item => { | |
| 63 | - return { | |
| 64 | - value: item, | |
| 65 | - label: item | |
| 66 | - }; | |
| 67 | - }); | |
| 68 | - this.options2 = list.filter(item => item.label.toLowerCase().indexOf(query.toLowerCase()) > -1); | |
| 69 | - }, 200); | |
| 70 | - } else { | |
| 71 | - this.options2 = []; | |
| 72 | - } | |
| 18 | + cityList: [ | |
| 19 | + { | |
| 20 | + value: 'New York', | |
| 21 | + label: 'New York' | |
| 22 | + }, | |
| 23 | + { | |
| 24 | + value: 'London', | |
| 25 | + label: 'LondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondon' | |
| 26 | + }, | |
| 27 | + { | |
| 28 | + value: 'Sydney', | |
| 29 | + label: 'Sydney' | |
| 30 | + }, | |
| 31 | + { | |
| 32 | + value: 'Ottawa', | |
| 33 | + label: 'Ottawa' | |
| 34 | + }, | |
| 35 | + { | |
| 36 | + value: 'Paris', | |
| 37 | + label: 'Paris' | |
| 38 | + }, | |
| 39 | + { | |
| 40 | + value: 'Canberra', | |
| 41 | + label: 'Canberra' | |
| 42 | + } | |
| 43 | + ], | |
| 44 | + model10: ['New York', 'London'] | |
| 73 | 45 | } |
| 74 | 46 | } |
| 75 | 47 | } | ... | ... |
src/styles/components/select.less
| ... | ... | @@ -205,9 +205,21 @@ |
| 205 | 205 | height: 24px; |
| 206 | 206 | line-height: 22px; |
| 207 | 207 | margin: 3px 4px 3px 0; |
| 208 | - //i{ | |
| 209 | - // top: 2px; | |
| 210 | - //} | |
| 208 | + max-width: 99%; | |
| 209 | + position: relative; | |
| 210 | + span{ | |
| 211 | + display: block; | |
| 212 | + margin-right: 14px; | |
| 213 | + overflow: hidden; | |
| 214 | + text-overflow: ellipsis; | |
| 215 | + white-space: nowrap; | |
| 216 | + } | |
| 217 | + i{ | |
| 218 | + display: block; | |
| 219 | + position: absolute; | |
| 220 | + right: 4px; | |
| 221 | + top: 4px; | |
| 222 | + } | |
| 211 | 223 | } |
| 212 | 224 | |
| 213 | 225 | &-large&-multiple .@{css-prefix}tag{ |
| ... | ... | @@ -215,7 +227,7 @@ |
| 215 | 227 | line-height: 26px; |
| 216 | 228 | font-size: @font-size-base; |
| 217 | 229 | i{ |
| 218 | - top: 1px; | |
| 230 | + top: 6px; | |
| 219 | 231 | } |
| 220 | 232 | } |
| 221 | 233 | |
| ... | ... | @@ -225,8 +237,12 @@ |
| 225 | 237 | font-size: @font-size-small; |
| 226 | 238 | padding: 0 6px; |
| 227 | 239 | margin: 3px 4px 2px 0; |
| 240 | + span{ | |
| 241 | + margin-right: 14px; | |
| 242 | + } | |
| 228 | 243 | i{ |
| 229 | 244 | top: 1px; |
| 245 | + right: 2px; | |
| 230 | 246 | } |
| 231 | 247 | } |
| 232 | 248 | ... | ... |