search

Home  >  Q&A  >  body text

javascript - vue v-modal object dynamic binding value problem?

<p class="text">
          <!--数据格式:{ "nestedList": { "test": { "test1": "this is test1" } } }-->
          {{source}}<br>
          <!--nestedList.test.test1-->
          {{schema_key}}
        <el-form-item :label="schema.title">
            <!--数据格式:source为vue中data值:{ "nestedList": { "test": { "test1": "this is test1" } } }-->
            <el-input v-model="??这里怎么写达到获取下面的效果呢?" size="small"></el-input>
            <!--这里有效果-->
          <!--<el-input v-model="source['nestedList']['test']['test1']" size="small"></el-input>-->
        </el-form-item>
      </p>

The following can be passed

source['nestedList']['test']['test1']

To achieve two-way binding (get the value of this is test1), what I want to ask is, how to write the above
v-model="???" here to achieve two-way binding v-model here It is a variable, I tried using

source+'.'+ schema_key

Cannot get the value this is test1

为情所困为情所困2857 days ago548

reply all(2)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-19 10:18:11

    I don’t quite understand the question

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-19 10:18:11


    The value in v-model is a separate value, not an object. If it is a string, it is fine

    data: {
        yourdata: '{ "nestedList": { "test": { "test1": "this is test1" } } }'
    }
    
    <el-input v-model="yourdata" size="small"></el-input>

    Or, use computed to calculate in real time, and then use value directly without v-model.

    reply
    0
  • Cancelreply