9 . 設(shè)置屏幕最小寬度 將兩個(gè)數(shù)組拼接到一個(gè)數(shù)組中(展開(kāi)運(yùn)算符) tree-table 樹(shù)形表格組件 作用域插槽template

1. 設(shè)置 屏幕最小 寬度

html, body, #app {
    height: 100%;
    margin: 0;
    padding: 0;
    /* 設(shè)置屏幕最小寬度 */
    min-width: 1100px;
}

當(dāng)打開(kāi)控制臺(tái)后, 屏幕寬度小于最小寬度時(shí),則會(huì)添加滾動(dòng)條

<br />

2. 將兩個(gè)數(shù)組拼接到一個(gè)數(shù)組

// 展開(kāi)運(yùn)算符可以合并兩個(gè)數(shù)組  ...arr1 表示將 arr1 里的數(shù)據(jù)全部展開(kāi)并添加到一個(gè)新的數(shù)組里
const arr1 = [1, 2]
const arr2 = [3, 4]
const all = [...arr1, ...arr2]
console.log(all)
// all  [1, 2, 3, 4]

<br />

3. 表格 tree-table 樹(shù)形表格組件 tree-table 地址:

npm i vue-table-with-tree-grid -S   版本 0.2.4

// vue-table-with-tree-grid  直接搜索會(huì)有 文檔教程
// main.js 中 導(dǎo)入
// 引入表格
import TreeTable from 'vue-table-with-tree-grid'
// 注冊(cè)成為全局組件
Vue.component('tree-table', TreeTable)

// vue 文件中使用
<tree-table></tree-table>
image

<br />

4. 作用域插槽 template

<template slot="opt" slot-scope="scope">
                <pre>
                    {{scope.row}}
                </pre>
            </template>

// <pre></pre> 文件預(yù)覽   slot 表示 作用域插槽的 名字

<br />

5. 作用域插槽 template 常用在表單里面

//  scope.row  表示 一整行的數(shù)據(jù)
<el-table-column label="操作">
              <template slot-scope="scope">
                <el-button size="mine" type="primary" icon="el-icon-edit"
                  @click="showEditDialog((scope.row.attr_id))">編輯</el-button
                >
                <el-button size="mine" type="danger" icon="el-icon-delete"
                  >刪除</el-button
                >
              </template>
            </el-table-column>
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容