惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
TaoSecurity Blog
TaoSecurity Blog
Apple Machine Learning Research
Apple Machine Learning Research
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
SegmentFault 最新的问题
T
Troy Hunt's Blog
N
News and Events Feed by Topic
雷峰网
雷峰网
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
PCI Perspectives
PCI Perspectives
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 三生石上(FineUI控件)
Schneier on Security
Schneier on Security
T
The Exploit Database - CXSecurity.com
L
LINUX DO - 最新话题
V
V2EX
T
Threat Research - Cisco Blogs
人人都是产品经理
人人都是产品经理
C
Cisco Blogs
The GitHub Blog
The GitHub Blog
爱范儿
爱范儿
I
Intezer
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
月光博客
月光博客
Recent Commits to openclaw:main
Recent Commits to openclaw:main
N
News | PayPal Newsroom
Cyberwarzone
Cyberwarzone
B
Blog
博客园 - 聂微东
P
Palo Alto Networks Blog
A
About on SuperTechFans
The Last Watchdog
The Last Watchdog
Scott Helme
Scott Helme
Google DeepMind News
Google DeepMind News
Webroot Blog
Webroot Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
O
OpenAI News
C
Check Point Blog
Hacker News: Ask HN
Hacker News: Ask HN
W
WeLiveSecurity
V
Vulnerabilities – Threatpost
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
A
Arctic Wolf

博客园 - Bob.Xie

如何把一个本地项目上传到git MySQL导出数据字典 java 判断日期是否小于本月 生成随机字符串 工具类 vue 日期控件el-date-picker 获取选择月份的最后一天 vue 数据导入加载样式 CSS文字过多设置省略号 Spring 本地获取文件 mybatis 批量新增和修改 SpringBoot 全局统一异常拦截器 List stream 数据处理 MySQL中concat,concat_ws以及group_concat的使用 Java获取当前日期属于今年的第几周 使用tesseract-ocr读取图片文字(转) idea 插件库 MySQL分组修改排序序号 查看Linux服务器连接数,Oracle表和索引分析 转载:查看Oracle连接数 转载:查看ORACLE最耗时的SQL
element-ui表格el-table回显时默认全选数据
Bob.Xie · 2021-08-24 · via 博客园 - Bob.Xie

1、html代码

<el-table ref="multipleTable"
          :data="tableData"
          style="width: 100%"
          :header-cell-style="{ 'background-color': '#F9F9F9' }"
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="45" :selectable="selectable"> </el-table-column>
          <el-table-column prop="pictureUrl" label="商品图片">
            <template slot-scope="scope">
              <img :src="scope.row.pictureUrl" height="50px" />
            </template>
          </el-table-column>
          <el-table-column prop="productName" label="商品名称">
          </el-table-column>
          <el-table-column prop="unitPrice" label="单价(含税)">
            <template slot-scope="scope">
              <span class="price">¥{{ scope.row.unitPrice || "0.00" }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="resourcesNo" label="资源号"> </el-table-column>
          <el-table-column prop="baleNo" label="捆包号"> </el-table-column>
          <el-table-column prop="grossWeight" label="重量(吨)"> </el-table-column>
          <el-table-column prop="grossWeight" label="状态">
            <template slot-scope="scope">
              <el-tag size="small" :type="scope.row.productState === 1 ? 'success':'info'">
                {{scope.row.productState === 1 ? '可用':'失效'}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="createTime" label="添加时间"> </el-table-column>
          <el-table-column prop="address" label="操作" width="100">
            <template slot-scope="scope">
              <el-button v-if="scope.row.productState === 1" size="mini" class="delete" @click="delRows(scope.row)"
                >删除</el-button>
              <el-button v-else size="mini" class="edit" @click="delRows(scope.row)"
              >移除失效商品</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="paginations" v-show="total>page.pageSize">
          <el-pagination
                  background
                  layout="prev, pager, next"
                  :total="total"
                  :page-size="page.pageSize"
                  @current-change="pagesClick"

          >
          </el-pagination>
        </div>

2、js代码

watch: {
    'tableData': function () {
      this.$nextTick(() => {
        this.tableData.forEach((item) => {
          if (item.productState === 1) {
            this.$refs.multipleTable.toggleRowSelection(item, true);
          }
        })
      })
    },
  },

posted @ 2021-08-24 19:46  Bob.Xie  阅读(1941)  评论()    收藏  举报