zoukankan      html  css  js  c++  java
  • Vue学习Day09-关于scope.row

    关于slot.row没有完全理解,暂且先挖个坑,后面学习明白了再补充一下.

    <el-table :data="userList" stripe style=" 100%">
          <el-table-column prop="username"label="姓名" width="180"></el-table-column>
          <el-table-column prop="email" label="邮箱" width="180"> </el-table-column>
          <el-table-column prop="mobile" label="电话"> </el-table-column>
          <el-table-column label="用户状态">
            <template slot-scope="scope">
              <el-switch v-model="scope.row.mg_state" @change="userstateChange(scope.row.id, scope.row.mg_state)">
              </el-switch>
            </template>
          </el-table-column>
          <el-table-column prop="adress" label="操作"> </el-table-column>
    </el-table>

    1.------------->   :data="userList"

    表格绑定了用于存储数据的数组,里面每一个元素都是数据对象

    2.------------->   slot-scope="scope"

    这是作用域插槽中定义一个对象(这里对象被定义为scope)来存储插槽上绑定的数据的用法

    3.------------->   scope.row

    在这里使用ElementUI表格模板渲染数据时,

    "当前行数据的获取也会用到插槽,scope相当于一行的数据, scope.row相当于当前行的数据对象,"(这是在网上看到的一个解释,暂且记下)

  • 相关阅读:
    JQuery Mobile
    JQuery
    JQuery Mobile
    JQuery Mobile
    JQuery Mobile
    5G && 物联网
    Sass(Syntactically Awesome Stylesheets)——概述(待续)
    Sass(Syntactically Awesome Stylesheets)——使用React JS实现
    Yarn概述——FAST, RELIABLE, AND SECURE DEPENDENCY MANAGEMENT
    webpack——Modules && Hot Module Replacement
  • 原文地址:https://www.cnblogs.com/zhou-135/p/11669197.html
Copyright © 2011-2022 走看看