1.el-upload
第一次没有上传文件提交触发效验后提示文件未上传,上传图片后再点击提交还是提示图片未上传
官网里说:由于 JavaScript 的限制,Vue 不能检测数组和对象的变化
解决方法:用原对象与要混合进去的对象的 property 一起创建一个新的对象
this.form2.chartUrl=res.url
this.form2=Object.assign({},this.form2)
2.el-table树形表格
要展开内部单独一行,需要先展开父行
this.$refs.table.toggleRowExpansion(item,true)
3.引入部分组件
npm install babel-plugin-component -D
npm install @babel/preset-env (注意,如果是vue2.0就不要安装默认版本了,参考版本如下:)
"@babel/preset-env": "^7.10.4",
然后,将 .babelrc 修改为:
{
"presets": [["@babel/preset-env", { "modules": false}]],
"plugins": [
"lodash",
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
]
}
//main.js内引入
import { Button, Select } from 'element-ui';
import App from './App.vue';
Vue.component(Button.name, Button);
Vue.component(Select.name, Select);
/* 或写为
* Vue.use(Button)
* Vue.use(Select)
*/