<template #default="scope">
          <el-tooltip effect="dark" placement="top">
            <template #content>
              <div class="set-popper">{{scope.row.content}}</div>
            </template>
            <div class="set-content">{{ scope.row.content }}</div>
          </el-tooltip>
        </template>
<style lang="scss" scoped>
.set-popper {
  max-width: 500px;
}
.set-content {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
</style>

el-table 设置固定宽度弹框-LMLPHP
案例:

<template>
  <div class="app-container">

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
            type="primary"
            plain
            size="mini"
            @click="handleAdd"
            v-hasPermi="['business:servermsg:add']"
        >
          <el-icon>
            <plus/>
          </el-icon>
          新增
        </el-button>
      </el-col>
    </el-row>

    <el-table v-loading="loading" :data="servermsgList" @selection-change="handleSelectionChange">
      <el-table-column label="序号" align="center" width="60" :show-overflow-tooltip="true">
        <template v-slot="scope">
          <span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
        </template>
      </el-table-column>
<!--      <el-table-column label="ID" align="center" prop="id"/>-->
      <el-table-column label="文案标题" align="center" prop="text"/>
      <el-table-column label="内容介绍" :align="center" prop="content">
        <template #default="scope">
          <el-tooltip effect="dark" placement="top">
            <template #content>
              <div class="set-popper">{{scope.row.content}}</div>
            </template>
            <div class="set-content">{{ scope.row.content }}</div>
          </el-tooltip>
        </template>

      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template v-slot="scope">
          <el-button
              size="mini"
              type="text"
              @click="handleUpdate(scope.row)"
          >
            <el-icon>
              <edit/>
            </el-icon>
            修改
          </el-button>
          <el-button
              size="mini"
              type="text"
              @click="handleDelete(scope.row)"
          >
            <el-icon>
              <delete/>
            </el-icon>
            删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
        v-show="total>0"
        :total="total"
        v-model:page="queryParams.pageNum"
        v-model:limit="queryParams.pageSize"
        @pagination="getList"
    />

    <!-- 添加或修改服务器管理对话框 -->
    <el-dialog :title="title" v-model="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">

        <el-form-item  label-position="right" label="文案标题" prop="text">
          <el-input    maxlength="200" show-word-limit v-model="form.text" placeholder="请输入文案标题"/>
        </el-form-item>
        <el-form-item  label="内容介绍" prop="content" label-width="100" >
          <editor v-model="form.content"  show-word-limit  :min-height="192"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<style lang="scss" scoped>
.set-popper {
  max-width: 500px;
}
.set-content {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
</style>

<script>
import {getGiraffeManorInstro, addGiraffeManorInstro, listGiraffeManorInstro, delGiraffeManorInstro, updateGiraffeManorInstro} from "@/api/business/giraffemanorInstro";
import Pagination from '@/components/Pagination'
export default {
  name: "Servermsg",
  data() {
    return {
      isDisable:false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 服务器管理表格数据
      servermsgList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        // serverId: [{ required: true, message: "服务器Id不能为空", trigger: "blur" }],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询服务器管理列表 */
    getList() {
      this.loading = true;
      listGiraffeManorInstro(this.queryParams).then(response => {
        this.servermsgList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加宣传配置";
      this.isDisable=false;
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      debugger
      const id = row.id || this.ids
      getGiraffeManorInstro(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.isDisable=true;
        this.title = "修改宣传配置";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          debugger
          if (this.form.id != null) {

            updateGiraffeManorInstro(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            debugger
            addGiraffeManorInstro(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除标题为"' + row.text + '"的数据项?').then(function () {
        return delGiraffeManorInstro(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    }
  }
};
</script>


11-08 10:06