vue:11 for textarea if

    xiaoxiao2023-11-11  159

    vue的for循环 

    for (const i in r.cities) { console.log(r.cities[i].name) }

    textarea 

    <el-input type="textarea" style="width:300px;" :autosize="{ minRows: 3}" placeholder="请输入内容" v-model="city.area" > </el-input>

    v-if

    <span v-for="(item,index) in city.cities" :key="index" > {{item.name}} <span v-if="index < city.cities.length-1"> 、 </span> <span v-else>!</span> </span>

    结果:

     

    长春市 、 吉林市 、 四平市 、 辽源市 、 通化市 、 白山市 、 松原市、 白城市 、 延边朝鲜族自治州 !

     

    最新回复(0)