在写一个基于vue2+element的项目的时候遇到的问题引入的element-UI斑马纹表格失效
下面是package.json文件的相关部分
"dependencies": {
"axios": "^1.6.7",
"core-js": "^3.8.3",
"echarts": "^4.9.0",
"element-ui": "^2.15.14",
"vue": "^2.6.14",
"vue-count-to": "^1.0.13",
"vue-router": "^3.5.1",
"vuex": "^3.6.2"
},
全局引入element组件
关于路由配置的代码
```javascript
{
path: '/application-manage',
meta: {
title: '申请管理'
},
component: () => import('@/layout/layout.vue'),
//二级路由
children: [
{
path: '/application-manage/index',
name: 'application-manage',
meta: {
title: '申请列表'
},
component: () => import('@/views/application-manage/IndexView.vue')
},
]
}
表格结构关键代码
```html
<template>
<div>
<el-row>
<el-col :span="22"><el-input type="text" placeholder="请输入名称" v-model="query"></el-input><div class="grid-content bg-purple"></div></el-col>
<el-col :span="2">
<el-button type="primary" click="queryName">搜索</el-button>
</el-col>
</el-row>
<el-table
:data="tableData"
stripe
style="width: 100%">
<el-table-column
prop="date"
label="日期"
width="180">
</el-table-column>
<el-table-column
prop="name"
label="姓名"
width="180">
</el-table-column>
<el-table-column
prop="address"
label="地址">
</el-table-column>
</el-table>
</div>
</template>
<script>
export default {
data() {
return {
query: "",//名称
//表格数据
tableData: [{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄'
}],
}
},