码上敲享录 > vue.js常见问题详解 > vue使用bootstrapTable标签明明存在表格就是渲染出不来

vue使用bootstrapTable标签明明存在表格就是渲染出不来

上一章章节目录下一章 2020-07-29已有1182人阅读 评论(0)

vue使用bootstrapTable标签明明存在表格就是渲染出不来


解决方法:

第一步检查所需的js和css文件是否引入

<!-- Bootstrap -->

<link href="/static/plugins/bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">

<script src="/static/plugins/bootstrap-3.3.7/js/bootstrap.min.js"></script>

<!-- Bootstrap table -->

 <link rel="stylesheet" href="/static/plugins/bootstrap-table/bootstrap-table.min.css">

 <script src="/static/plugins/bootstrap-table/bootstrap-table.min.js"></script>

 <script src="/static/plugins/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>


第二步

如果你页面的bootstrapTable标签是根据条件显示的,也就是有v-if="pageType==1",导致你的bootstrapTable出不来的原因可能是你页面还没渲染完就已经执行了$('#table').bootstrapTable({})初始化表格了,所以可以尝试以下代码:

监听v-if中的条件变量,等这个变量在页面渲染完成之后再初始化表格

watch:{

           pageType:function(){

               this.$nextTick(function () {

                   $('#table').bootstrapTable({})

               })


           }}


向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交