vue前端页面随笔

目录

@keyup.enter.native 注解不生效

:show-overflow-tooltip='true' 显示不全

表格根据条件改变单元格字体颜色

@keyup.enter.native 注解不生效
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
      <el-form-item label="姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item style="margin-left: 80px">
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

上述注解为 键盘回车触发事件

解决方法:

在 el-form 上添加 @submit.native.prevent
:show-overflow-tooltip='true' 显示不全
<el-table v-loading="loading" border max-height="550" :data="dataList">
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="经历" align="center" prop="experience" key="experience" v-if="columns[0].visible" width="180" :show-overflow-tooltip='true' fixed/>
</el-table>

上述属性为:表格中该列的内容,超过当前单元格时,隐藏多余部分

当鼠标指针放在内容上时,上方出现窗口显示全部内容,且默认宽度为全屏

解决方法:css改变宽度

<style type="text/css">
.el-tooltip__popper {
  font-size: 14px;
  max-width: 50%
}
</style>
表格根据条件改变单元格字体颜色

el-table 标签中加入 :cell-style="cellStyle" 事件

methods 中编写函数 cellStyle

<el-table v-loading="loading" border :max-height="tableMaxHeight" :data="dataList" 
:cell-style="cellStyle" @selection-change="handleSelectionChange">
</el-table>
    cellStyle({
                row, // 行
                column, // 列
                rowIndex, // 行索引
                columnIndex, // 列索引
              }) {
      if ((row.age > 24) && columnIndex === 6)
        return 'color : red';
    },

(row.age > 24) && columnIndex === 6 为判断条件,并指定列索引下标为 6 的列进行样式改变

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值