1.效果展示
2.代码
checkList.vue代码
<template>
<div class="radio">
<label class="title">{
{
title}}</label>
<a href="#"
v-for="(item, index) in options"
:key="index"
class="radioLink">
<div class="radioList">
<div class="radioArea">
<label>
<span>
<input type="checkbox"
:value="typeof item == 'string' ? item : item.value"
class="radioInput"
v-model="selectedValue"
:disabled="typeof item == 'string' ? false : item.disabled == true ? true :false">
<span class="radioSelect"
:class="typeof item == 'string' ? '' : item.disabled == true ? 'radioSelectDisabled' : '' "></span>
</span>
<span class="selectListItem">{
{
typeof item == 'string' ? item : item.label}}</span>
</label>
</div>
</div>
</a>
</div>
</template>
<script>
export default {
name: 'checkList',
data () {
return {
selectedValue: []
}
},
props: {
title: String,
options: [Srting,Array]
},
created () {
// console.log(typeof (this.options));
if (typeof (this.options