- 1、element中切换时间日期选择器时下拉框偏移到左上角的问题
- 1、日期范围选择控件,限制只能选择30天
- 2、table固定表头、固定列
- 3、el-select的multiple属性从false切换为true时页面值不清空
- 4、cascader获取当前选择的整个对象
- 5、vue2-org-tree 组织架构图
- 6、富媒体wangEditor v5,系统中之前装的是v3
- 1、保留4位有效数字
- 2、watch的应用
- vue中bus.$on事件被多次绑定">3、vue中bus.$on事件被多次绑定
- 4、js数组(找到第一个符合条件的元素)
- 5、JavaScript(ES 6)统计数组内符合条件数据的简洁方法
- 6、JS中获取一个对象数组中的id的最大值方法
- 7、js动态生成唯一id
- 8、table 表头 有单位 想换行
- 9、js 数组对象中某个属性的最大值和最小值
- 10、echarts动态获取dataZoom滑动条改变后的数据
- 11、vue mathjs使用方法(js 精度)
- 12、el-table 根据返回的颜色代码 把颜色标出来
- 13、用vue.js渲染后获取内容高度的问题
- 14、echarts Cannot read property ‘getAttribute’ of null
- 15、数组比大小
- 15、vue中使用echarts中的扩展 ecStat.js
- element-ui 清除form-item错误的显示">16.element-ui 清除form-item错误的显示
- el-input 自定义校验规则">17.el-input 自定义校验规则
- el-step 上一步 和下一步">18.el-step 上一步 和下一步
- 19.组织架构树组件vue-org-tree
- 20.通过文件流的形式下载word和window.location.href直接下
- 21.toExponential() 方法可把对象的值转换成指数计数法。
- 22.element ui + vue项目翻页页码定义是number,但是出现”个“字
- localStorage.getItem得到的是[object Object] 的解决方案">23.localStorage.getItem得到的是[object Object] 的解决方案
- JS设置浏览器缩放比例">24.JS设置浏览器缩放比例
- 25.使用pdf.js 来做pdf预览
- 25.四元运算符
- 26.vue 使用 el-dialog 获取元素为null的解决方法
- 27.Vue + Element table中selection复选框禁用某一行
- 28.echarts图片转为base64
- 29.vue dom 结构转为base64
- 30.el-input输入框中只能输入数字,并且取小数点后两位
- 31.vue实现简单防抖(watch input)
- 32、js 多条件多数据筛选
- 33.js 数组对象有多层数据,只保留两层的解决办法
- 34.el-date-picker 时间选择器回显后无法修改
- 在vue项目中 如何定义全局变量 全局函数">35.在vue项目中 如何定义全局变量 全局函数
- 使用方式2:
- 36.vue 打印
- 37、echarts 套娃柱形图
- 38.如何解决el-table出现一条线
- 39.上传格式限制
https://element.eleme.cn/#/zh-CN
- 学习各种组件的基本用法
- 编写一些实例
1、element中切换时间日期选择器时下拉框偏移到左上角的问题
https://blog.csdn.net/html5_student/article/details/122616312
第一次点击都是正常的,但是第二次直接偏移到左上角。
解决方案:
在el-date-picker里面加上 key=“XXXX”即可 名字随便取
1、日期范围选择控件,限制只能选择30天
https://blog.csdn.net/liming1016/article/details/120112482
<el-date-picker v-model="value1" type="daterange"start-placeholder="开始日期"range-separator="至"end-placeholder="结束日期"value-format="yyyy-MM-dd":picker-options="pickerOptions1"></el-date-picker>
data () {return {value1: '', // 日data1Map: new Map(),data2Map: new Map(),pickerMinDate: null,pickerMaxDate: null,day31: 31 * 24 * 3600 * 1000,// 日期使用pickerOptions1: {onPick: ({ maxDate, minDate }) => {if (minDate && this.pickerMinDate) {this.pickerMinDate = null;} else if (minDate) {this.pickerMinDate = minDate.getTime();}},disabledDate: (time) => {if (this.pickerMinDate) {return (time.getTime() > (this.pickerMinDate + this.day31)) || (time.getTime() < (this.pickerMinDate - this.day31));}return false;}},};},
2、table固定表头、固定列
https://blog.csdn.net/RRRRRDong/article/details/118862371
使用position:sticky来固定表头 ```
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
```#common-table {width: 100%;height: 500px;overflow: hidden;}#table-container {height: 400px;overflow-y: auto;display: block;width: 100%;table-layout: fixed;}#table-container thead {border-left: 1px solid #DFE2EB;border-top: 1px solid #DFE2EB;position: sticky;top: 0;left: 0;right: 0;display: table;width: 100%;table-layout: fixed;}#table-container thead tr>th {background-color: #fafafa;font-size: 14px;font-family: Microsoft YaHei UI;font-weight: bold;color: #333333;border-bottom: 1px solid #DFE2EB;border-right: 1px solid #DFE2EB;padding: 15px;}#table-container thead tr>th>div {padding: 5px 10px;min-width: 40px;display: flex;align-items: center;justify-content: center;}#table-container tbody {border-left: 1px solid #DFE2EB;display: table;width: 100%;table-layout: fixed;}#table-container tbody tr>td {font-size: 12px;font-family: Microsoft YaHei UI;font-weight: 400;padding: 13px;}#table-container td,#table-container th {border-bottom: 1px solid #DFE2EB;border-right: 1px solid #DFE2EB;text-align: center;padding: 5px;}
3、el-select的multiple属性从false切换为true时页面值不清空
https://wenku.baidu.com/view/adae929cfe0a79563c1ec5da50e2524de518d0c5.html
关键点:先把值undefined 再用this.$nextTick
this.$set(this.form.appointmentUserList[index],'userIds',undefined);this.$nextTick(() => {if(checkWzArr[checkWzArr.length-1].positionKey){this.multiple=false;this.$set(this.form.appointmentUserList[index],'userIds',null);}else{this.multiple=true;this.$set(this.form.appointmentUserList[index],'userIds',[]);}})
4、cascader获取当前选择的整个对象
//element组件里的 getCheckedNodes 获取选中的节点getCascaderObj(val, opt) {return val.map(function(value, index, array) {for (let itm of opt) {if (itm.id === value) {opt = itm.childVO;return itm;}}return null;});},//切换岗位postChange(value,index){let checkWzArr = this.getCascaderObj(value, this.postOptions); //选中节点数据},
5、vue2-org-tree 组织架构图
https://gitee.com/hukaicode/vue-org-tree
6、富媒体wangEditor v5,系统中之前装的是v3
cmd 中 vue —version 查看vue版本 我是2.9.6
官网:
https://www.wangeditor.com/v5/installation.html#npm
安装 editor
npm install @wangeditor/editor —save
安装 Vue2 组件
npm install @wangeditor/editor-for-vue —save
使用
<div style="border: 1px solid #ccc; margin-top: 10px;"><!-- 工具栏 --><Toolbar style="border-bottom: 1px solid #ccc" :editor="editor" :defaultConfig="toolbarConfig"></Toolbar><!-- 编辑器 --><Editor style="height: 400px; overflow-y: hidden;":defaultConfig="editorConfig"v-model="form.fileContentHtml"@onCreated="onCreated"></Editor></div><script>import { Editor, Toolbar } from '@wangeditor/editor-for-vue'export default {name: 'tableOne',props:['businessTypeList'],components:{Editor, Toolbar},data() {return {isShow:false,editor: null,//toolbarConfig:{} 表示默认分配菜单toolbarConfig: {toolbarKeys:[// 菜单 key'headerSelect',// 分割线'|',// 菜单 key'bold', 'italic','through','sub','sup','clearStyle','color','bgColor','fontSize','fontFamily','indent','delIndent','justifyLeft','justifyRight','justifyCenter','justifyJustify','lineHeight','divider','insertLink','unLink','blockquote','redo','undo','bulletedList','numberedList','insertTable','uploadImage',]},editorConfig: {placeholder: '请输入内容...',MENU_CONF: {uploadImage: {// 小于该值就插入 base64 格式(而不上传),默认为 0base64LimitSize: 5000 * 1024, // 默认上限为5000k},}},};},methods: {onCreated(editor) {this.editor = Object.seal(editor) // 【注意】一定要用 Object.seal() 否则会报错//console.log(editor.getAllMenuKeys().toString())},beforeDestroy() {const editor = this.editor;if (editor == null) return;editor.destroy() // 组件销毁时,及时销毁 editor ,重要!!!},}</script><style src="@wangeditor/editor/dist/css/style.css"></style>
注意:一个页面多个编辑器 共用 toolbarConfig 和 editorConfig
<el-col :span="24"><el-form-item label="安全生产责任制:" prop="content1":rules="[{ required: true, message: '安全生产责任制不能为空!', trigger: 'change' }]"><div style="border: 1px solid #ccc; margin-top: 10px;"><!-- 工具栏 --><Toolbar style="border-bottom: 1px solid #ccc" :editor="editor1" :defaultConfig="toolbarConfig"></Toolbar><!-- 编辑器 --><Editor style="height: 400px; overflow-y: hidden;":defaultConfig="editorConfig"v-model="form.content1"@onCreated="onCreated1"></Editor></div></el-form-item></el-col><el-col :span="24"><el-form-item label="责任制说明/履职清单:" prop="content2":rules="[{ required: true, message: '责任制说明/履职清单不能为空!', trigger: 'change' }]"><div style="border: 1px solid #ccc; margin-top: 10px;"><!-- 工具栏 --><Toolbar style="border-bottom: 1px solid #ccc" :editor="editor2" :defaultConfig="toolbarConfig"></Toolbar><!-- 编辑器 --><Editor style="height: 400px; overflow-y: hidden;":defaultConfig="editorConfig"v-model="form.content2"@onCreated="onCreated2"></Editor></div></el-form-item></el-col>
onCreated1(editor) {this.editor1 = Object.seal(editor); // 【注意】一定要用 Object.seal() 否则会报错},onCreated2(editor) {this.editor2 = Object.seal(editor); // 【注意】一定要用 Object.seal() 否则会报错},beforeDestroy() {const editor1 = this.editor1;const editor2 = this.editor2;if (editor1 == null || editor2 == null) return;editor1.destroy(); // 组件销毁时,及时销毁 editor ,重要!!!editor2.destroy(); // 组件销毁时,及时销毁 editor ,重要!!!},
禁用富媒体
// 禁用if(this.target === 'edit'){this.editor.disable();}else{this.editor.enable();}
1、保留4位有效数字
this.formCompute.CC.P = Math.pow(2.718281828459,temp_1).toPrecision(4);
2、watch的应用
https://www.cnblogs.com/jin-zhe/p/9319648.html
<template><div><el-input v-model="demo"></el-input>{{value}}</div></template><script>export default {name: 'index',data() {return {demo: '',value: ''};},watch: {demo(val) {this.value = this.demo;}}};</script>
<template><div><el-input v-model="demo.name"></el-input>{{value}}</div></template><script>export default {name: 'index',data() {return {demo: {name: ''},value: ''};},computed: {newName() {return this.demo.name;}},watch: {newName(val) {this.value = val;}}};</script>
如果watch监测的是一个对象的话,直接使用watch是不行的,此时我们可以借助于computed计算属性来完成
3、vue中bus.$on事件被多次绑定
https://www.cnblogs.com/shirliey/p/11327126.html
4、js数组(找到第一个符合条件的元素)
https://blog.csdn.net/qq_43681948/article/details/106872531
5、JavaScript(ES 6)统计数组内符合条件数据的简洁方法
数组示例let users = [ {“name”:“张三”,“age”: 10},{“name”:“李四”,age: 14},{“name”:“王五”,age: 9},…]要求统计出数组里年龄大于10的人数。方法一:使用filter和lengthconst result = users.filter(u => u.aage > 10 ).length;方法二:使用reduceconst result = users.reduce((c, u) => u + (u.age > 10), 0)
6、JS中获取一个对象数组中的id的最大值方法
https://blog.csdn.net/chenludaniel/article/details/104564569/
var lists = [{id:1,title:'22'},{id:1212,title:'2122'},{id:132,title:'2额122'}]最终可以用一行代码var result = Math.max(...lists.map(x => x.id));
7、js动态生成唯一id
8、table 表头 有单位 想换行
https://blog.csdn.net/weixin_38779534/article/details/103022901
<el-table-column prop="time" :label="'时间\n'+ unitCon.timeUnit" align="center"></el-table-column>.el-table .cell{white-space:pre-line;text-align: center;}
9、js 数组对象中某个属性的最大值和最小值
https://blog.csdn.net/cargelzhong/article/details/81458610
Math.max.apply(Math, array.map(function(o) {return o.value}))Math.min.apply(Math, array.map(function(o) {return o.value}))
10、echarts动态获取dataZoom滑动条改变后的数据
<div id='main2' style='width:600px;height:600px;background: #ddd'></div>var myChart_y = echarts.init(document.getElementById('main2'));var option = {tooltip: {trigger: 'axis',axisPointer: {type: 'shadow'},},dataZoom: [{show: true,realtime: true,// start: 30,// end: 70,// xAxisIndex: [0, 1]},{type: 'inside',realtime: true,// start: 30,// end: 70,// xAxisIndex: [0, 1]}],xAxis: {},yAxis: {},series: [{symbolSize: 20,data: [[10.0, 8.04],[8.0, 6.95],[13.0, 7.58],[9.0, 8.81],[11.0, 8.33],[14.0, 9.96],[6.0, 7.24],[4.0, 4.26],[12.0, 10.84],[7.0, 4.82],[5.0, 5.68],],type: 'scatter'}]};//显示图表let oldData = [[10.0, 8.04],[8.0, 6.95],[13.0, 7.58],[9.0, 8.81],[11.0, 8.33],[14.0, 9.96],[6.0, 7.24],[4.0, 4.26],[12.0, 10.84],[7.0, 4.82],[5.0, 5.68],];myChart_y.setOption(option);myChart_y.on('datazoom',function(params){let xAxis=myChart_y.getModel().option.xAxis[0];//获取axislet newData = [];let xRStar = xAxis.rangeStart;let yREnd = xAxis.rangeEnd;oldData.forEach(item=>{if(item[0]>=xRStar && item[0] <= yREnd){newData.push(item)}})console.log(newData)})
11、vue mathjs使用方法(js 精度)
npm install mathjs --savemain.js中import * as math from 'mathjs'Vue.prototype.$math = math;页面中this.$math.format((this.upQ / value),4); //精度为4
12、el-table 根据返回的颜色代码 把颜色标出来
<el-table-column prop="color" label="等级对应颜色" align="center"><template scope="scope"><div class="colorItem" :style="{background:scope.row.color}"></div></template></el-table-column>
13、用vue.js渲染后获取内容高度的问题
https://www.imooc.com/wenda/detail/496576
14、echarts Cannot read property ‘getAttribute’ of null
if (document.getElementById('tmradLine2')) {this.$chart.line3('tmradLine2',scatters,left,right,xMin,yMin,xMax,yMax,xUnit,yUnit);}
15、数组比大小
//this.xTimeMinData = Math.min.apply(Math,this.tableNewData .map(function(item) {return item.time}));let se = [[3,5],[1,8],[0.1,3]]let ssew = Math.min.apply(Math,se .map(function(item) {return item[0]}));console.log(ssew) //0.1
15、vue中使用echarts中的扩展 ecStat.js
https://blog.csdn.net/qq_35366269/article/details/98945413
16.element-ui 清除form-item错误的显示
https://www.cnblogs.com/ygunoil/p/12336418.html
this.$refs.ruleForm.clearValidate() 这个方法可以实现
17.el-input 自定义校验规则
https://blog.csdn.net/shulan5/article/details/103810317
18.el-step 上一步 和下一步
next() {if (this.active++ > 4) this.active = 0;},back() {--this.active;if (this.active < 0) this.active = 0;}
19.组织架构树组件vue-org-tree
https://www.cnblogs.com/10ve/p/12573772.html
https://blog.csdn.net/weixin_38187317/article/details/86524258
http://www.mamicode.com/info-detail-2964091.html
npm i vue2-org-treemain.js中import Vue2OrgTree from 'vue2-org-tree'Vue.use(Vue2OrgTree);import './assets/css/orgTree.css'; //组织树状图
20.通过文件流的形式下载word和window.location.href直接下
api.jsexport const msdsDownload = (params) =>{ return request.post(`${base_new}/msds/download-word?${params}`,{ responseType: 'arraybuffer' }).then(res => res); };let id = null;for (let i = 0; i < this.multipleSelection.length; i++) {id += this.multipleSelection[i].msdsId;if (i < this.multipleSelection.length - 1) {id += ",";}}const params = Qs.stringify({id: id});msdsDownload(params).then(res=>{console.log(res)let blob = new Blob([res], {type: `application/msword` //word文档为msword,pdf文档为pdf});let objectUrl = URL.createObjectURL(blob);let link = document.createElement("a");let fname = `我的文档`; //下载文件的名字link.href = objectUrl;link.setAttribute("download", fname);document.body.appendChild(link);link.click();})
api.js
let base_new = 'http://192.168.1.202:8780';
export const downloadUrl = base_new;
文件中
import { downloadUrl } from '../../../api/index'; //导出的地址
let id = null;
for (let i = 0; i < this.multipleSelection.length; i++) {
id += this.multipleSelection[i].msdsId;
if (i < this.multipleSelection.length - 1) {
id += ",";
}
}
window.location.href = downloadUrl+'/msds/download-word?id='+id
21.toExponential() 方法可把对象的值转换成指数计数法。
https://www.w3school.com.cn/jsref/jsref_toexponential.asp
22.element ui + vue项目翻页页码定义是number,但是出现”个“字

https://blog.csdn.net/qq_32881447/article/details/105602565
https://www.jianshu.com/p/82db266d82b7
23.localStorage.getItem得到的是[object Object] 的解决方案
https://www.cnblogs.com/ralapgao/p/11119063.html
localStorage.setItem("localKey", JSON.stringify(this.cartGroup))
方法1: JSON.parse(localStorage.getItem("localKey")
方法2: eval("("+localStorage.getItem("localKey")+")")
24.JS设置浏览器缩放比例
https://blog.csdn.net/weixin_42776111/article/details/108252759
main.js 中
var t = window.devicePixelRatio // 获取下载的缩放 125% -> 1.25 150% -> 1.5
if(t != 1){ // 如果进行了缩放,也就是不是1
document.body.style.zoom = -0.6 * t + 1.55; // 就去修改页面的缩放比例,这个公式我自己算的,不准确,勉强。
}
25.使用pdf.js 来做pdf预览
https://www.cnblogs.com/linjiangxian/p/13730954.html
1. 下载pdfjs
官网:http://mozilla.github.io/pdf.js/getting_started/#download

2. 放入项目中
将下载下来的文件解压缩后,将里面的pdf文件夹拷贝到项目中的public文件夹中
3. 页面中使用
window.open('/pdf/web/viewer.html?file=' + path);//path是文件的全路径地址
api/index.js中
let base_new = 'http://myrc-soft.qicp.vip:54262';
export const downloadUrl = base_new;
sds.vue
// 预览pdf附件
viewFile(index,row){
localStorage.setItem("filename", 'SDS-'+row.chName+'-附件.pdf'); //解决下载pdf时名字都是document.pdf
let path = downloadUrl+'/attachment/view/sds/'+ row.msdsId;
window.open('/pdf/web/viewer.html?file=' + path); //path是pdf文件的全路径地址
},
viewer.js
let defaultFilename = localStorage.getItem("filename");

4. 出现的问题
过程中,出现了一次报错 “file origin does not match viewer’s”
原因:跨域
解决方法: 直接注释掉web/viewer.js中的2183到21856这几行,不去判断跨域即可
if (origin !== viewerOrigin && protocol !== 'blob:') {
throw new Error('file origin does not match viewer\'s');
}
25.四元运算符
var state = null;
var display_state = (state == null ? "未用" : (state == true ? "在用" : "停用"))
//display_state
//"未用"
一般三元运算符就够用了,
但是此时有个需求:state有3个状态,{null,true,false}
null→未用
true→在用
false→停用
26.vue 使用 el-dialog 获取元素为null的解决方法
https://blog.csdn.net/qq_36926583/article/details/107671734
this.$nextTick(function() {
let qrBox = document.getElementById('qrcode') // 获取到div元素
})
27.Vue + Element table中selection复选框禁用某一行
https://blog.csdn.net/weixin_41562512/article/details/88344550
<el-table-column
type="selection"
:selectable='checkboxT'
width="28">
</el-table-column>
//复选框
checkboxT(row, rowIndex){
if(rowIndex==0){
// if(row.lie =='1'){
return false;//禁用
}else{
return true;//不禁用
}
},
28.echarts图片转为base64
//echarts转base64图片
chartsBase64(id){
let baseCanvas = document.getElementById(id).getElementsByTagName('canvas')[0];
let width = baseCanvas.width;
let height = baseCanvas.height;
let ctx = baseCanvas.getContext("2d");
ctx.drawImage(baseCanvas,width,height);
return baseCanvas.toDataURL();
// console.log(baseCanvas.toDataURL())
// this.url = baseCanvas.toDataURL()
},
29.vue dom 结构转为base64
npm install html2canvas -d
30.el-input输入框中只能输入数字,并且取小数点后两位
https://blog.csdn.net/qq_30405009/article/details/110956379
<el-input
v-model.trim="setting.satisfiedRateIndex"
style="width: 150px"
@keyup.native="
setting.satisfiedRateIndex = oninput(setting.satisfiedRateIndex)
"
></el-input>
oninput(value) {
console.log(value, typeof value, value.replace(/[^\.\d]/g, ""));
let str = value;
let len1 = str.substr(0, 1);
let len2 = str.substr(1, 1);
//如果第一位是0,第二位不是点,就用数字把点替换掉
if (str.length > 1 && len1 == 0 && len2 != ".") {
str = str.substr(1, 1);
}
//第一位不能是.
if (len1 == ".") {
str = "";
}
if (len1 == "+") {
str = "";
}
if (len1 == "-") {
str = "";
}
//限制只能输入一个小数点
if (str.indexOf(".") != -1) {
let str_ = str.substr(str.indexOf(".") + 1);
if (str_.indexOf(".") != -1) {
str = str.substr(0, str.indexOf(".") + str_.indexOf(".") + 1);
}
}
//正则替换
str = str.replace(/[^\d^\.]+/g, ""); // 保留数字和小数点
str = str.replace(/^\D*([0-9]\d*\.?\d{0,2})?.*$/, "$1"); // 小数点后只能输 2 位
return str;
},
31.vue实现简单防抖(watch input)
<input type="text" v-model="searchStr">
const app = new Vue({
el:"#app",
data:{
searchStr:"",
fun:null
},
watch:{
searchStr: function (str) {
if (typeof str ==='string'){
if (str.trim().length!==0){
this.debounce(this.changeStr,1000);
}else {}
}
}
},
methods:{
debounce:function(fn,wait){
if (this.fun!==null){
clearTimeout(this.fun)
}
this.fun = setTimeout(fn,wait)
},
changeStr:function(data){
console.log(data)
},
}
效果:当我持续快速向input输入时,只有停顿1秒才执行一次事件
32、js 多条件多数据筛选
https://segmentfault.com/q/1010000013394483
var conditionArr=[{
name:'广州',
type:'area'
},{
name:'一本',
type:'batch'
}];
var dataArr=[{
name:'广州大学1',
area:'广州',
batch:'一本'
},{
name:'广州大学2',
area:'广州',
batch:'一本'
},{
name:'广州大学3',
area:'深圳',
batch:'一本'
},{
name:'广州大学4',
area:'深圳',
batch:'二本'
},{
name:'广州大学5',
area:'广州',
batch:'二本'
},{
name:'广州大学6',
area:'广州',
batch:'二本'
}];
// conditionArr是筛选的条件(动态变化的),当conditionArr多一个数组时,dataArr中的每个对象就会多一个属性【此处简化属性,刚开始就有对应值】
var temp=[],bool;
for(var i=0;i<dataArr.length;i++){
bool = true
for(var j=0;j<conditionArr.length;j++){
if (dataArr[i][conditionArr[j].type] !== conditionArr[j].name){
bool = false;
}
}
bool && temp.push(dataArr[i])
}
console.log(temp);
33.js 数组对象有多层数据,只保留两层的解决办法
https://blog.csdn.net/qq_42292873/article/details/109306573
34.el-date-picker 时间选择器回显后无法修改
https://blog.csdn.net/weixin_42769637/article/details/107815831
this.$set(this.form,”alldate”,[this.form.startdate,this.form.endate])
35.在vue项目中 如何定义全局变量 全局函数
https://www.cnblogs.com/kewenxin/p/8619240.html
使用方式2:
36.vue 打印
https://www.cnblogs.com/lovebear123/p/13860938.html
37、echarts 套娃柱形图

option = {
tooltip: {
trigger:"axis",
formatter:"{a1}<br/>{b1}:{c1}%"
},
legend: {
data:['优秀','良好','一般','实际']
},
grid: {
},
xAxis: [{
data: ["衬衫","羊毛衫","雪纺衫","裤子"]
},{
type: 'category',
axisLine: {show: false},
axisTick: {show: false},
axisLabel: {show: false},
splitArea: {show: false},
splitLine: {show: false},
},{
type: 'category',
axisLine: {show: false},
axisTick: {show: false},
axisLabel: {show: false},
splitArea: {show: false},
splitLine: {show: false},
}
],
color:['#f9caca','#bfbfbf','#7f7f7f','#de1a37'],
yAxis: [{
axisLabel:{
formatter:"{value}%"
}
}],
series: [{
name: '优秀',
type: 'bar',
barWidth: 100,
barGap: '-100%',
data: [100, 100, 100, 100]
},
{
name: '良好',
type: 'bar',
barWidth: 100,
data: [78, 87, 77, 80]
},
{
name: '一般',
type: 'bar',
barWidth: 100,
data: [50, 52, 48, 59]
},
{
name: '实际',
type: 'bar',
barWidth: 50,
xAxisIndex: 2,
data: [88, 97, 38, 62]
}]
};
38.如何解决el-table出现一条线
.el-table::before{ z-index: inherit;}
https://blog.csdn.net/weixin_43900414/article/details/108261108
39.上传格式限制
class=”upload-basic”
:on-change=”handlePreview”
multiple
:auto-upload=”isAuto”
:show-file-list=”false”
ref=”upload”
accept=”.pdf,.PDF”
>

