1.ctrl+左键单击多选,单击单选
精简代码
<div class="model-list">
<div
@mousedown.prevent="handleClick(item, $event)"
class="model-list-item"
v-for="item in modelList"
:key="item.id"
:class="{ 'model-active': item.active }"
>
{
{ item.name }}
</div>
</div>
//script
public modelList = [
{
id: 0,
name: '马栏山方案-HR-0001',
active: false,
},
{
id: 1,
name: '马栏山方案-HR-0002',
active: false,
},
{
id: 2,
name: '马栏山方案-HR-0003',
active: false,
},
];
//单选 状态切换
modelSelect(info: any) {
this.modelList.forEach(item => {