This commit is contained in:
梁灏 2017-09-07 11:19:19 +08:00
parent 6f719603a8
commit 1f41c9ca2c
3 changed files with 40 additions and 53 deletions

View file

@ -1,59 +1,46 @@
<template>
<div>
<h4>有remote属性</h4>
{{ selectedIds }}
<i-select remote clearable filterable multiple :label="selectedLabel" v-model="selectedIds" style='margin-bottom:20px;'>
<i-option v-for="option in list" :value="option.id" :key="option.id">{{option.name}}</i-option>
</i-select>
<i-button @click="setVal3">设置3</i-button>
<Select v-model="model1" style="width:200px">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
<Select v-model="model2" style="width:200px">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
</div>
</template>
<script>
export default {
data () {
return {
list: [],
selectedIds: [],
selectedLabel: []
cityList: [
{
value: 'beijing',
label: '北京市'
},
{
value: 'shanghai',
label: '上海市'
},
{
value: 'shenzhen',
label: '深圳市'
},
{
value: 'hangzhou',
label: '杭州市'
},
{
value: 'nanjing',
label: '南京市'
},
{
value: 'chongqing',
label: '重庆市'
}
],
model1: 'beijing',
model2: 'shanghai'
}
},
methods: {
setVal1: function () {
this.selectedLabel = ['几何', '化学'];
this.selectedIds = ['201701041343', '201701011541']
},
setVal2: function () {
this.selectedLabel = ['政治', '英语', '数学'];
this.selectedIds = ['201701031442', '201701061244', '201701011145']
},
setVal3: function () {
this.selectedLabel = [];
this.selectedIds = [];
}
},
mounted () {
setTimeout(() => {
this.list = [{
name: '语文',
id: '201701011046'
}, {
name: '数学',
id: '201701011145'
}, {
name: '英语',
id: '201701061244'
}, {
name: '几何',
id: '201701041343'
}, {
name: '政治',
id: '201701031442'
}, {
name: '化学',
id: '201701011541'
}]
}, 1000)
}
}
</script>

View file

@ -1,18 +1,18 @@
<template>
<div>
<i-switch v-model="m1" :true-value="1" :false-value="0">
<i-switch v-model="m1" true-value="yes" false-value="no">
<span slot="open"></span>
<span slot="close"></span>
</i-switch>
{{ m1 }}
<div @click="m1 = 0">toggle</div>
<div @click="m1 = 'no'">toggle</div>
</div>
</template>
<script>
export default {
data () {
return {
m1: 1
m1: 'yes'
}
},
methods: {

View file

@ -1,8 +1,8 @@
<template>
<span :class="wrapClasses" @click="toggle">
<span :class="innerClasses">
<slot name="open" v-if="currentValue"></slot>
<slot name="close" v-if="!currentValue"></slot>
<slot name="open" v-if="currentValue === trueValue"></slot>
<slot name="close" v-if="currentValue === falseValue"></slot>
</span>
</span>
</template>
@ -48,7 +48,7 @@
return [
`${prefixCls}`,
{
[`${prefixCls}-checked`]: this.currentValue,
[`${prefixCls}-checked`]: this.currentValue === this.trueValue,
[`${prefixCls}-disabled`]: this.disabled,
[`${prefixCls}-${this.size}`]: !!this.size
}