Vue watch监听不起作用

当前页面:home.vue

<template>
  <div>
    <div class="chart-wrap">
    <nodata v-if="tableNoData" class="newnodata"></nodata>
    <jtable :tableData="tableData" :showColumns="showColumns" :storeDate="store_date" :isDetail='isDetail'></jtable>
    </div>
  <noNetwork v-if="noNetwork"></noNetwork>
  </div>
</template>

import nodata from 'src/components/modelNoData.vue';
import noNetwork from 'src/components/noNetwork.vue';
import table from 'src/components/table/table.vue';

export default {
  components: {
    table,
    nodata,
    noNetwork
  },
  data() {
    noNetwork: false,
    tableNoData: false,
tableData:[]
  }
}

 

组件:table.vue
<template> <div class="table" id="table"> <table border="1" borderColor="#e5e5e5" class="scrollTable"> <!-- 表头 --> <thead :class="{'time_xi': tableData.columns[0].field == 'time_xi'}"> </thead> <tbody> <template v-for="(item,indexs) in tableData"> <tr><td></td></tr> <div v-show='i==indexs' class='detailr' :style='{height:h+"rem"}'></div> </template> </tbody> </table> </div> </template> export default { props: ['tableData'], data() { return { i: 'i', } }, watch: { //引用类型变量、采用深度监听 tableData: { // 表格数据刷新后需清空之前查看的订单详情内容 handler: function (newVal, oldVal) { this.i = 'i'; }, deep: true }, }
}

 

转载于:https://www.cnblogs.com/janederek/p/9295285.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值