vue datatables 实现动态刷新

需求描述:最近需要写一个界面,主要功能是实现模态框的动态刷新

问题:可是涉及到自动刷新就有问题了,因为每次获取数据都是全量数据,用dataTable组装表格的话,页面会一直一直闪!里面绘制的表格会不断出现异常

如图这个是我做好的动态刷新,下面的请求是每隔5秒刷新一次,解决问题的主要方法如下(最终解决方法是在datatables的API 中找到的):

 

 
<template id="interface-statistics-modal" >
   <div class="modal fade" id="secondary-modal" data-toggle="modal" tabindex="-1" role="dialog" >
      <div class="modal-dialog  modal-lg" role="document">
         <div class="modal-content" >
            <div class="modal-header">
               <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
               </button>
               <a class="pull-right help" >
                  <i class='fa fa-question-circle' ></i>
               </a>
               <h4 class="modal-title">{
  {title}}</h4>
            </div>
            <div class="modal-body">
               <table id="interface_statistics_table" class="table table-hover table-bordered table-striped">
                  <thead>
                  <tr>
                     <th>{
  {$t('slb.vs_name')}}</th>
                     <th>{
  {$t('slb.server_type')}}</th>
                     <th>{
  {$t('net.ip_address')}}</th>
                     <th>{
  {$t('net.status')}}</th>
                     <th>{
  {$t('slb.connect_number')}}</th>
                     <th>{
  {$t('slb.new_connect')}}</th>
                     <th>{
  {$t('slb.HTTP_request_rate')}}</th>
                     <th>{
  {$t('slb.request_flow')}}</th>
                     <th>{
  {$t('slb.response_flow')}}</th>
                  </tr>
                  </thead>
               </table>
            </div>
         </div>
      </div>
   </div>
</template>
<script>
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值