{
path: '/h3/data-source-edit/:state/:id',//- state 新增/编辑 ,id 数据行
name: 'dataSourceEdit',
component: dataSourceEdit,
meta: {
title: '数据源列表',
code: 20801,
keepAlive: true, // 需要被缓存
}
},
96.activated钩子函数
<li v-for="_item in item.list" @mousedown="mouseDown($event,_item,item.type)" draggable="true" @ondragstart="dragStart" @ondragend="dragEnd">{{_item.name}}</li>
dragOver(e){
e.preventDefault()
}
98.:key要放在真正的html元素上,不能放在 99. vue不能自动更新数组对象
import Vue from 'vue'
Vue.set(arr,index, newItem)
//or
// cols.splice(colIndex+1,0,dragItem)
// cols.splice(colIndex,1)
100.兄弟组件通信方式
//bus.js
import Vue from 'vue'
export default new Vue()
//组件A
import Bus from './bus.js'
Bus.$emit('val', this.elementValue)
//组件B
import Bus from './bus.js'
Bus.$on('val', (data) => {
console.log(data)
})
101.子组件修改父组件的属性:
104 .flex布局导致滚动条消失或者内容遮挡:
:style="'width:'+previewData.ticketWidth+'mm'"
:style="{'font-size':col.fontSize+'px;',width:col.width+'mm','font-weight':col.bold?'bold':'normal','font-style':col.italic?'italic':'normal'}"
106.js常用数组操作
107.上传txt到服务器
//上传文件方法
//MDN File说明:https://developer.mozilla.org/zh-CN/docs/Web/API/File/File
upladFile(str,callback) {
try {
let that=this
let fileObj = new File([str],'template.txt',{type:"text/plain"})//创建file文件
let url = this.$H3HYDEE.upload.FILEUPLOADURL; // 接收上传文件的后台地址
let form = new FormData(); // FormData 对象
form.append("file", fileObj); // 文件对象
let xhr = new XMLHttpRequest(); // XMLHttpRequest 对象
xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。
xhr.onload = (evt)=>{
let data = JSON.parse(evt.target.responseText);
if(data.file) {
callback(data.file)
}else{
this.handlerMessage.error('模板上传失败!')
}
}; //请求完成
xhr.onerror = (evt)=>{
this.handlerMessage.error('模板上传失败!')
};
let ot,oloaded
xhr.upload.onloadstart = function(){//上传开始执行方法
ot = new Date().getTime(); //设置上传开始时间
oloaded = 0;//设置上传开始时,以上传的文件大小为0
};
xhr.send(form); //开始上传,发送form数据
}catch(e){
}
108.两个坑
109.安装nodejieba失败
if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "'node" rebuild )
internal/modules/cjs/loader.js:582
throw err;
^
Error: Cannot find module 'C:\SVN\h3_web\trunk\h3_manager\node_modules\nodejieba\'node'
110.webstrom使用git拉gitlab代码报错:
Repository test failed Authentication failed ...
解决: