el-select里<template #prefix> 如果el-option循环的LIst没有数据导致prefix不显示的问题

<el-select v-model="streetValue" id="departNode" placeholder="请选择" @change="handleSelectStreet" :popper-append-to-body="false" clearable @clear="handleClearStreet">
      <template #prefix>
        <svg-icon icon-class="dingwei" style="margin-right: 5px" />
      </template>
      <el-option value="" label="暂无数据" v-if="!streetList.length"></el-option> //选择添加这个来占位 如果streetList在没有数据的情况下 就使用这个来当默认的label  这样这个#prefix里面的值就出现了
<el-option v-for="item in streetList" :key="item.street_uuid" :label="item.grid_name" :value="item.street_uuid"> </el-option> </el-select>

  

posted @ 2025-04-21 15:08  熬夜的布偶猫#  阅读(81)  评论(0)    收藏  举报