常用问题记录(更新中)

1、elementui table 合计行不显示

# 第一种解决方法
 /deep/
 .el-table__footer-wrapper{
   position: fixed;
}

# 第二种解决方法,我是加在 :summary-method="getSummaries"  getSummaries这个函数体内。

this.$nextTick(() => {
        this.$refs.table.doLayout();
});

# 两种方法都试过,有效(2019-10-16)

2、Support for the experimental syntax 'decorators-legacy' isn't currently

// babel < 7
babel-plugin-transform-decorators-legacy
/package.json
"plugins": ["transform-decorators-legacy"// babel > 7
@babel/plugin-proposal-decorators

"plugins": [
  ["@babel/plugin-proposal-decorators", { "legacy": true }],
  //...
]

// 使用的是creat-react-app 创建的,babel 7+ 使用以上方案仍然报错
// 最终解决方案:
yarn add customize-cra @babel/plugin-proposal-decorators react-app-rewired
// 修改package.json
"scripts": {
  "start": "react-scripts start",
  "start": "react-app-rewired start",
  //...
}
// 根目录新建/config-overrides.js
const { override,addDecoratorsLegacy } = require("customize-cra");
  module.exports = override(
    addDecoratorsLegacy(),
  );

3、解构获取最后一位

const {length,len=length-1,[len]:last} = [1,2,3,4,5,6]
const {5:last} = [1,2,3,4,5,6]

4、elementui table 表格错乱

  <z-table   row-key="id"></z-table>

5、具名插槽-循环变量方式

<template v-for="locale in MONTH_LIST" #[getSlotName(locale)]="{ row }">
  <div :key = 'locale'>
    ...
  </div>
</template>

methods:{
  getSlotName(v){
    return `key${v}`
  }
}

--

posted @ 2019-10-16 17:18  1146937621  阅读(248)  评论(0编辑  收藏  举报