optimize Checkbox in single type without slot

optimize Checkbox in single type without slot
This commit is contained in:
梁灏 2016-11-07 17:15:06 +08:00
parent 9a9e103f4c
commit 71699f6b29
2 changed files with 9 additions and 2 deletions

View file

@ -18,7 +18,7 @@
v-model="checked"
@change="change">
</span>
<slot><span>{{ value }}</span></slot>
<slot v-if="showSlot"><span v-el:slot>{{ value }}</span></slot>
</label>
</template>
<script>
@ -42,7 +42,8 @@
return {
model: [],
selected: false,
group: false
group: false,
showSlot: true
}
},
computed: {
@ -75,6 +76,9 @@
ready () {
if (!this.group) {
this.updateModel();
if (this.$els.slot && this.$els.slot.innerHTML === '') {
this.showSlot = false;
}
}
},
methods: {

View file

@ -141,6 +141,8 @@
<Breadcrumb-item href="/components/breadcrumb">Components</Breadcrumb-item>
<Breadcrumb-item>Breadcrumb</Breadcrumb-item>
</Breadcrumb>
<br><br>
<Checkbox :checked.sync="single"></Checkbox>
</template>
<script>
import { Radio, Alert, Icon, Collapse, Button, Checkbox, Switch, InputNumber, Breadcrumb, LoadingBar } from 'iview';
@ -172,6 +174,7 @@
},
data () {
return {
single: false,
radio: false,
radioGroup: '段模',
activeKey: [1,2],