赞
踩
vue3项目中引入element plus 时 引入 element css报错:
[vite] Internal server error: No known conditions for "./lib/theme-chalk/index.css" specifier in "element-plus" package
import 'element-plus/lib/theme-chalk/index.css' // 多了个lib
import ElementPlus from 'element-plus'
检查得知,包路径多了个lib,删除后可以正常使用,如下所示:
import 'element-plus/theme-chalk/index.css'
import ElementPlus from 'element-plus'
正常引入element以及其样式文件后,实现表单列表,代码如下:
<template>
<div>
<div class="search-line">
<label>姓名</label>
<input style="margin-left: 10px;" placeholder="请输入姓名">
<label style="margin-left: 30px;">证件号码</label>
<input style="margin-left: 10px;" placeholder="请输入证件号码">
<el-button type="primary" style="margin-left: 20px;">搜索</el-button>
</div>
<div class="list">
<el-table stripe :data="tableData" style="width: 100%">
<el-table-column prop="no" label="序号" width="80">
</el-table-column>
<el-table-column prop="idNumber" label="证件号码" width="230">
</el-table-column>
<el-table-column prop="phone" label="联系方式" width="200">
</el-table-column>
<!-- <el-table-column prop="address" label="地址">
</el-table-column> -->
<el-table-column label="地址">
<el-table-column prop="province" label="省份" width="120">
</el-table-column>
<el-table-column prop="city" label="市区" width="120">
</el-table-column>
<el-table-column prop="address" label="地址" width="100">
</el-table-column>
</el-table-column>
<el-table-column prop="upTime" label="上报时间" width="180">
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope" style="display: flex;">
<el-button size="mini">编辑</el-button>
<el-button size="mini" type="danger">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import { mapMutations } from 'vuex'
export default {
name: 'Login',
data() {
return {
username: '',
password: '',
tableData: [{
"no": "1",
"idNumber": "893580235129058230580",
"phone": "12323278478",
"province": '江西',
'city': '上饶',
"address": '武汉市',
"upTime": '2023-10-13 14:47',
}, {
"no": "1",
"idNumber": "893580235129058230580",
"phone": "12323278478",
"province": '浙江',
'city': '杭州',
"address": '武汉市',
"upTime": '2023-10-13 14:47',
}, {
"no": "1",
"idNumber": "893580235129058230580",
"phone": "12323278478",
"province": '湖北',
'city': '武汉',
"address": '武汉市',
"upTime": '2023-10-13 14:47',
}],
}
},
methods: {
handleEdit(index, row) {
console.log(index, row);
},
handleDelete(index, row) {
console.log(index, row);
}
},
}
</script>
<style>
.search-line {
display: flex;
align-items: center;
}
.list {
margin-top: 20px;
display: flex;
flex-direction: column;
}
</style>
运行结果如下:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。