iframe嵌套
<iframe width="100%" height="100%" :src="src" frameborder="0" id="iframeId"></iframe>
//在地址变化后页面没有变化可以使用这个
if (document.getElementById('iframeId')) {
setTimeout(() => {
document
.getElementById('iframeId')
.contentWindow.location.reload(true)
}, 200)
}
//我的理解可以这样使用总线 eventBus
import Vue from 'vue';
const eventBus=new Vue();
export {eventBus}
eventBus.$on('rowClick', (currentRow) => {
if (currentRow.name == 'xxx') {
this.src =
window.location.origin +
``
}
if (xxxx) {
eventBus.$emit('rowClick', {
name: 'xxx',
id: newValue.caseList[0].faultId,
})
}
el-table
//使用:cell-class-name="tableCellClassName" 比使用row-class-name这个更容易显示高亮
tableCellClassName({ row, rowIndex }) {
if (xxx) {
return 'rowHightLight'
} else {
return ''
}
},
导出页面为PDF格式
import html2Canvas from 'html2canvas'
import JsPDF from 'jspdf'
export default {
install(Vue,options){
Vue.prototype.getPdf = function(code,name,sum,e){
html2Canvas(documnet.querySelector('#pdfDom2'),{
allowTaint:true
}).then(function(canvas){
let contentWidth = canvas.width
let contentHeight = canvas,height
let pageHeight = contentWidth / 592.28 * 841.89
let leftHeight = contentHeight
let position = 0
let imgWidth = 595.28
let imgHeight = 592.28 / contentWidth * contentHeight
let pageData = canvas.toDataURL('image/jpeg',1.0)
let PDF = new JsPDF('','a1','p4')
if(leftHeight < pageHeight){
PDF.addImage(pageData,'JPEG',0,0,imgWidth,imgHeight)
} else{
while(leftHeigth >0) {
PDF.addImage(pageData,'JPEG',0,position,imgWidth,imgHeight)
leftHeight -= pageHeight
position -= 841.89
if(leftHeight > 0){
PDF.addPage()
}
}
}
PDF.save(code+'-'+'name'+'-'+sum+'.pdf')
e.target.style.pointerEvents = 'auto'
})
}
}
}
//在vue的main文件引入
import pdf from 'xx'
Vue.use(pdf)
//批量引入全局组件
import common from './componet'
Object.keys(common).forEach((key)=>{
var name = key.replace(/(\w)/,(v)=>v.toUpperCase())
Vue.component(`v${name}`,common[key])
})
//暴露方式采用默认暴露
export default {}
import { regionData } from 'element-china-area-data' //饿了么全地图省市区的下拉菜单
juejin.cn/post/684490… 上面地址为文件下载的5种方法
// 1.form表单提交 2.window.open或location.href 3.a标签的download 4.利用Blob对象 5.利用base64
小问题整理:
el-dialog弹框重新打开有滚动条,会一直在同一个位置使用下面2个属性打开弹框会在顶部
:lock-scroll="false" //主要是这个属性
:append-to-body="true" //跟这个属性
el-form change下拉验证新增时出现可以在组件或弹框开始时增加下面的属性
this.$refs.xxxx.clearValidate()
nvm下载node指南 github.com/coreybutler… nvm list -查看node版本 nvm install -安装指定版本的node 配置nvm的镜像服务器 nvm node_mirror npmmirror.com/mirrors/nod… nvm install lts -安装稳定版 nvm use xxx 指定要使用的node版本