data中有嵌套,取值要链式取

talk is cheap ,show you my code:

<template>
  <div class="">
    BackTop2
    <div>

      <h1>{{abc.def.hij}}</h1>
      <input v-model="abc.def.hij"/>


      <el-button type="primary" @click="btnClicked">主要按钮1</el-button>

    </div>
  </div>

</template>


<script>



export default {

  name: 'BackTop2',
  components: {

  },
  methods:{
    btnClicked(){
      this.abc.def.hij = "点击按钮更换值"
    }
  },
  data(){
    return{
      abc:{
        def:{
          hij:'最里面'
        }
      }
    }
  }

}
</script>

<style>

</style>
此文仅为鄙人学习笔记之用,朋友你来了,如有不明白或者建议又或者想给我指点一二,请私信我。liuw_flexi@163.com/QQ群:582039935. 我的gitHub: (学习代码都在gitHub) https://github.com/nwgdegitHub/
原文地址:https://www.cnblogs.com/liuw-flexi/p/13790674.html