文本框输入内容,然后改变遍历填空的答案

新手上路,请多包涵

image.png

image.png

<view class="content">

    
    <rich-text 
        :nodes="title" ></rich-text>
        <br>
    <view v-for="(item,index) in title.match(/_+/gi)"
        :key="index" >
        <text >{{index+1}}.</text>
        <input  maxlength="10" v-model="title1"/>
    </view>
</view>


title1 : '输入改变横线',
            title: `我的身高:______<span> 
            <span style='color:red'>(厘米)</span> 
             体重:______<span style='color:red'>(公斤)(1公斤=2市斤)</span>(公斤)(1公斤=2市斤)`
阅读 1.2k
1 个回答

computed:

data: {
    return {
       high: '',
       weight: ''
    }
},
computed: {
    title: function () {
      return `我的身高:${this.high||'____'}<span> 
            <span style='color:red'>(厘米)</span> 
             体重:${this.weight||'____'}<span style='color:red'>(公斤)(1公斤=2市斤)</span>(公斤)(1公斤=2市斤)`
    }
  }

highweight 綁定到你的 input 上。

推荐问题