<SearchItemLabel text="周期" /> 代表每一个文本信息。
<SearchItemInput> : 标签代表每一个输入框, 或者每一个下拉框。
调用搜索的方法的时候:
1: this.$refs.divBar.style.display = "block";
把block 显示出来
<SearchButtons>: 代表按钮组: <Button @click="reset">重置</Button> : 代表每一个按钮事件。
Select: 下拉框默认显示第一条数据: 在data 数据源中: searchModel: { top: "week" }, 默认显示第一条数据。
<div id="xxxx" ref="divBar" style="width: 100%; height: 600px; margin-top: 0.3rem"></div>
拿到div 引用元素: 点击重置按钮: 把echarts 隐藏掉:
1: this.$refs.divBar.style.display = "block"; // 把echarts 显示。
2: 当点击重置按钮的时候:把echarts 隐藏掉。
1: 导出按钮操作: <Button @click="exportData"> 导出</Button>
exportData: function () {
api
.get(传递参数, { url: `xxxxxxxxxx` })
.then((res) => {
if (res && res.result == "1") {
downLoadFile({ path: res.path, name: "导出操作" });
} else if (res) {
throw new Error(res.details);
} else {
throw new Error("导出失败,请稍后再试!");
}
})
.catch((errData) => {
this.$Modal.error({
title: "错误",
content: errData.message,
});
});
},
在导出方法操作: 调用api 接口操作。 加上传递参数, 拼接上url 路径: 如果res 存在或者res.result == ‘1’; 调用下载方法:
downloadFile ({path: res.path, name: "导出数据"})
else if (res) { throw new Error (res.details)} else { throw new Error:"导出失败, 请稍后重试"}
.catch 方法: 使用箭头函数: 使用弹框进行弹出 this.$Modal.error({
title: "错误" // 弹框标题
content: errData.message, // 弹框内容
})