demo6.vue 419 B

12345678910111213141516171819202122232425262728293031
  1. <template>
  2. <view class="">
  3. <button @click="change">修改</button>
  4. <view class="margin-left-50" v-for="(item,index) in list" :key="index">
  5. <text>{{item.name}}</text>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. name: '',
  12. data() {
  13. return {
  14. list:[{
  15. id:1,
  16. name:'a'
  17. }]
  18. };
  19. },
  20. methods:{
  21. change(){
  22. this.list[0].name='b'
  23. }
  24. }
  25. };
  26. </script>
  27. <style lang="scss" scoped>
  28. </style>