0
点赞
收藏
分享

微信扫一扫

vue:11 for textarea if

仲秋花似锦 2023-04-21 阅读 29


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 条评论