fixed #778
This commit is contained in:
parent
545aa32b43
commit
01b8d340c5
2 changed files with 19 additions and 86 deletions
|
@ -1,56 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<Checkbox v-model="single" @on-change="s">Checkbox</Checkbox>
|
|
||||||
{{ single }}
|
|
||||||
<div @click="single = !single">single-change</div>
|
|
||||||
<br>
|
|
||||||
{{ social }}
|
|
||||||
<Checkbox-group v-model="social" @on-change="s">
|
|
||||||
<Checkbox label="twitter">
|
|
||||||
<Icon type="social-twitter"></Icon>
|
|
||||||
<span>Twitter</span>
|
|
||||||
</Checkbox>
|
|
||||||
<Checkbox label="facebook">
|
|
||||||
<Icon type="social-facebook"></Icon>
|
|
||||||
<span>Facebook</span>
|
|
||||||
</Checkbox>
|
|
||||||
<Checkbox label="github">
|
|
||||||
<Icon type="social-github"></Icon>
|
|
||||||
<span>Github</span>
|
|
||||||
</Checkbox>
|
|
||||||
<Checkbox label="snapchat">
|
|
||||||
<Icon type="social-snapchat"></Icon>
|
|
||||||
<span>Snapchat</span>
|
|
||||||
</Checkbox>
|
|
||||||
</Checkbox-group>
|
|
||||||
<br>
|
|
||||||
<div @click="c">修改1</div>
|
|
||||||
{{ fruit }}
|
|
||||||
<Checkbox-group v-model="fruit">
|
<Checkbox-group v-model="fruit">
|
||||||
<Row>
|
<Checkbox v-for="item in tags" :label="item.label"></Checkbox>
|
||||||
<i-col span="8">
|
|
||||||
<Checkbox label="香蕉"></Checkbox>
|
|
||||||
</i-col>
|
|
||||||
<i-col span="8">
|
|
||||||
<Checkbox label="苹果"></Checkbox>
|
|
||||||
</i-col>
|
|
||||||
<i-col span="8">
|
|
||||||
<Checkbox label="西瓜"></Checkbox>
|
|
||||||
</i-col>
|
|
||||||
</Row>
|
|
||||||
</Checkbox-group>
|
|
||||||
<br><br>
|
|
||||||
<div style="border-bottom: 1px solid #e9e9e9;padding-bottom:6px;margin-bottom:6px;">
|
|
||||||
<Checkbox
|
|
||||||
:indeterminate="indeterminate"
|
|
||||||
v-model="checkAll"
|
|
||||||
@click.prevent.native="handleCheckAll">全选</Checkbox>
|
|
||||||
</div>
|
|
||||||
<Checkbox-group v-model="checkAllGroup" @on-change="checkAllGroupChange">
|
|
||||||
<Checkbox label="香蕉"></Checkbox>
|
|
||||||
<Checkbox label="苹果"></Checkbox>
|
|
||||||
<Checkbox label="西瓜"></Checkbox>
|
|
||||||
</Checkbox-group>
|
</Checkbox-group>
|
||||||
|
<div>{{ fruit }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -59,45 +12,23 @@
|
||||||
return {
|
return {
|
||||||
social: ['facebook', 'github'],
|
social: ['facebook', 'github'],
|
||||||
fruit: ['苹果'],
|
fruit: ['苹果'],
|
||||||
single: false,
|
tags: []
|
||||||
indeterminate: true,
|
|
||||||
checkAll: false,
|
|
||||||
checkAllGroup: ['香蕉', '西瓜']
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
mounted () {
|
||||||
c () {
|
setTimeout(() => {
|
||||||
this.social.splice(0, 1)
|
this.tags = [
|
||||||
|
{
|
||||||
|
label: '香蕉'
|
||||||
},
|
},
|
||||||
s (d) {
|
{
|
||||||
console.log(d)
|
label: '苹果'
|
||||||
},
|
},
|
||||||
handleCheckAll () {
|
{
|
||||||
if (this.indeterminate) {
|
label: '西瓜'
|
||||||
this.checkAll = false;
|
|
||||||
} else {
|
|
||||||
this.checkAll = !this.checkAll;
|
|
||||||
}
|
|
||||||
this.indeterminate = false;
|
|
||||||
|
|
||||||
if (this.checkAll) {
|
|
||||||
this.checkAllGroup = ['香蕉', '苹果', '西瓜'];
|
|
||||||
} else {
|
|
||||||
this.checkAllGroup = [];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
checkAllGroupChange (data) {
|
|
||||||
if (data.length === 3) {
|
|
||||||
this.indeterminate = false;
|
|
||||||
this.checkAll = true;
|
|
||||||
} else if (data.length > 0) {
|
|
||||||
this.indeterminate = true;
|
|
||||||
this.checkAll = false;
|
|
||||||
} else {
|
|
||||||
this.indeterminate = false;
|
|
||||||
this.checkAll = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -90,6 +90,8 @@
|
||||||
if (!this.group) {
|
if (!this.group) {
|
||||||
this.updateModel();
|
this.updateModel();
|
||||||
this.showSlot = this.$slots.default !== undefined;
|
this.showSlot = this.$slots.default !== undefined;
|
||||||
|
} else {
|
||||||
|
this.parent.updateModel(true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue