optimize Checkbox in single type without slot
optimize Checkbox in single type without slot
This commit is contained in:
parent
9a9e103f4c
commit
71699f6b29
2 changed files with 9 additions and 2 deletions
|
@ -18,7 +18,7 @@
|
||||||
v-model="checked"
|
v-model="checked"
|
||||||
@change="change">
|
@change="change">
|
||||||
</span>
|
</span>
|
||||||
<slot><span>{{ value }}</span></slot>
|
<slot v-if="showSlot"><span v-el:slot>{{ value }}</span></slot>
|
||||||
</label>
|
</label>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -42,7 +42,8 @@
|
||||||
return {
|
return {
|
||||||
model: [],
|
model: [],
|
||||||
selected: false,
|
selected: false,
|
||||||
group: false
|
group: false,
|
||||||
|
showSlot: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -75,6 +76,9 @@
|
||||||
ready () {
|
ready () {
|
||||||
if (!this.group) {
|
if (!this.group) {
|
||||||
this.updateModel();
|
this.updateModel();
|
||||||
|
if (this.$els.slot && this.$els.slot.innerHTML === '') {
|
||||||
|
this.showSlot = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -141,6 +141,8 @@
|
||||||
<Breadcrumb-item href="/components/breadcrumb">Components</Breadcrumb-item>
|
<Breadcrumb-item href="/components/breadcrumb">Components</Breadcrumb-item>
|
||||||
<Breadcrumb-item>Breadcrumb</Breadcrumb-item>
|
<Breadcrumb-item>Breadcrumb</Breadcrumb-item>
|
||||||
</Breadcrumb>
|
</Breadcrumb>
|
||||||
|
<br><br>
|
||||||
|
<Checkbox :checked.sync="single"></Checkbox>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { Radio, Alert, Icon, Collapse, Button, Checkbox, Switch, InputNumber, Breadcrumb, LoadingBar } from 'iview';
|
import { Radio, Alert, Icon, Collapse, Button, Checkbox, Switch, InputNumber, Breadcrumb, LoadingBar } from 'iview';
|
||||||
|
@ -172,6 +174,7 @@
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
single: false,
|
||||||
radio: false,
|
radio: false,
|
||||||
radioGroup: '段模',
|
radioGroup: '段模',
|
||||||
activeKey: [1,2],
|
activeKey: [1,2],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue