首先贴上完整的代码和对应图:
<template >
<div class="hello">
<div class="searchDiv">
<el-col :span="4">
<!-- 查询输入框 -->
<el-input v-model="input" placeholder="请输入内容"></el-input>
</el-col>
<el-button type="primary" icon="el-icon-search" @click="search(input)">搜索</el-button>
<!-- 模态框 -->
<el-button type="primary" @click="toAdd">新添书籍</el-button>
<el-dialog title="添加书籍" :visible.sync="dialogFormVisible">
<el-form>
<el-form-item label="书名" :label-width="formLabelWidth">
<el-input v-model="bookName"></el-input>
</el-form-item>
<el-form-item label="作者" :label-width="formLabelWidth">
<el-input v-model="bookAuthor"></el-input>
</el-form-item>
<el-form-item label="价格" :label-width="formLabelWidth">
<el-input v-model="bookPrice"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="add(bookName,bookAuthor,bookPrice)">保存</el-button>
</div>
</el-dialog>
</div>
<div class="tableDiv">
<el-table :data="tableData" style="width: 100%" ref="myTable">
<el-table-column type="index" :index="inde