el-table组件的封装

news2025/6/23 21:38:59

前言:仔细看懂本篇博客,玩转element table 不成问题 ,个人理解所谓封装,就是把经常都要公用的东西,拿出来,可以多次复用。公用方法,公用页面都可以封装。

其实封装也并不是有多难,思路也很简单,就是用JS来控制页面。页面动态性越强,组件越灵活,适用范围越广。

就vue+element的组件封装而言,先把所有功能在子页面实现。然后把js里面的动态值,拿到父组件里面去传过来,就完成了,其中技术也就掌握父子组件传值而已。
该组件封装适应于绝大多数table列表,可以自定义列

废话不多说看下例子

先上子组件代码 

<template>
  <div class="table-box">
    <el-table ref="tableData" v-loading="loading" style="width: 100%" :row-key="rowKey" :data="tableData" :height="tableHeight" highlight-current-row v-bind="tableInfo" :span-method="objectSpanMethod" v-on="events" @selection-change="handleSelectionChange">
      <slot name="expand" />
      <el-table-column v-if="selectAllTemplate" min-width="140" label="全选模板列表">
        <template slot-scope="{ row }">
          <div>
            <el-checkbox v-model="row.all" @change="muBanAllToggleSelection($event, tableData, row)">
              {{ row.muBanMC }}
            </el-checkbox>
          </div>
        </template>
      </el-table-column>
      <!-- 多选 -->
      <el-table-column v-if="needSelect" type="selection" reserve-selection width="55" align="center" />
      <el-table-column v-if="hasIndex" label="序号" width="50" type="index" />
      <template v-for="(item, index) in tableColumn">
        <!-- 此列需要自定义 -->
        <el-table-column v-if="item.isSlot" :key="'%' + index" :show-overflow-tooltip="showOverflowTooltip" v-bind="item" :render-header="item.renderHeader" v-on="events">
          <template slot-scope="{ row, $index }">
            <ex-slot v-if="item.render" :render="item.render" :row="row" :index="$index" :column="item" :class="item.prop" :default-value="item.defaultValue" />
            <slot v-else :name="item.prop" :row="row" />
          </template>
        </el-table-column>
        <!-- 正常列 -->
        <el-table-column v-else :key="'%' + index" :show-overflow-tooltip="showOverflowTooltip" v-bind="item" v-on="events" />
      </template>
      <el-table-column v-if="hasOperation" fixed="right" label="操作" :min-width="operationWidth">
        <!-- <template v-if="!btnButton || btnButton.length === 0" slot-scope="scope">
          <slot name="operation" :row="scope.row" :index="scope.$index" />
        </template> -->
        <template v-if="btnButton.length" slot-scope="{ row, column, $index }">
          <el-button v-show="value.isShow(row, column, $index)" :disabled="value.isDisable(row, column, $index)" v-for="(value, i) in btnButton" :key="'$' + i" size="small" :type="value.type" :icon="value.icon" :class="value.class" @click="value.callback(row, column, $index)">
            {{ value.text }}
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <div v-if="isNeedPagination" style="display: flex; justify-content: flex-end; align-item: centerl; padding-top: 15px">
      <el-pagination
        ref="pagination"
        :page-sizes="pageSizes"
        :page-size.sync="computedPageSize"
        :hide-on-single-page="isSinglePageHide"
        layout="total, sizes, prev, pager, next, jumper"
        :current-page.sync="computedCurrentPage"
        :total="total"
        :pager-count="pagerCount"
        @current-change="currentChange"
        @size-change="sizeChange"
      />
    </div>
  </div>
</template>
<script>
// 自定义组件的内容
const exSlot = {
  functional: true,
  props: {
    row: Object,
    render: Function,
    index: Number,
    column: {
      type: Object,
      default: null
    },
    defaultValue: [Number, String]
  },

  render: (h, ctx) => {
    const params = {
      row: ctx.props.row,
      index: ctx.props.index
    }
    const defaultValue = ctx.props.defaultValue
    params.column = ctx.props.column || {}
    return h(
      'div',
      {
        class: [params.column.prop || '', params.column.class || params.column.className || ''].join('')
      },
      [ctx.props.render(h, params) || defaultValue]
    )
  }
}
export default {
  name: 'PublicTable',
  components: {
    'ex-slot': exSlot
  },
  props: {
    // key
    rowKey: {
      type: String,
      default: ''
    },
    // 超出行是否隐藏不换行
    showOverflowTooltip: {
      type: Boolean,
      default: true
    },
    // 是否需要多选
    needSelect: {
      type: Boolean,
      default: false
    },
    // 是否需要序号
    hasIndex: {
      type: Boolean,
      default: false
    },
    // 是否需要分页
    isNeedPagination: {
      type: Boolean,
      default: true
    },
    // 是否单页隐藏,默认为true
    isSinglePageHide: {
      type: Boolean,
      default: false
    },
    // 当前页页码,支持.sync修饰符
    currentPage: {
      type: Number,
      default: 1
    },
    // 页码显示数据量
    pagerCount: {
      type: Number,
      default: 7
    },
    // 每页数据条数, 支持.sync修饰符默认为每页10条
    pageSize: {
      type: Number,
      default: 20
    },
    // 数据总条数
    total: {
      type: Number,
      default: 0
    },
    // 每页多少数据
    pageSizes: {
      type: Array,
      required: false,
      default: () => [20, 40, 80, 100]
    },
    // 表格绑定的属性
    tableInfo: {
      type: Object,
      default: () => {}
    },
    // 获取数据时是否需要加载loading
    loading: {
      type: Boolean,
      default: false
    },
    // table数据源
    tableData: {
      type: Array,
      default: () => []
    },
    // 表格项绑定的属性
    tableColumn: {
      type: Array,
      default: () => []
    },
    // 是否需要操作列
    hasOperation: {
      type: Boolean,
      default: true
    },
    // 操作列
    btnButton: {
      type: Array,
      default: () => []
    },
    // 操作列宽度
    operationWidth: {
      type: String,
      default: '120px'
    },
    // 表格方法
    events: {
      type: Object,
      default: () => {}
    },
    // 合并单元格
    objectSpanMethod: {
      type: Function,
      default: () => {}
    },
    // 全选项绑定的函数
    muBanAllToggleSelection: {
      type: Function,
      default: () => {}
    },
    // 是否显示全选项
    selectAllTemplate: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {}
  },
  computed: {
    computedCurrentPage: {
      get() {
        return this.currentPage
      },
      set(val) {
        this.$emit('update:currentPage', val)
      }
    },
    computedPageSize: {
      get() {
        return this.pageSize
      },
      set(val) {
        this.$emit('update:pageSize', val)
      }
    },
    tableHeight() {
      return !this.isNeedPagination ? '100%' : 'calc(100% - 47px)'
    }
  },
  mounted() {},
  methods: {
    getTableRef() {
      return this.$refs.tableData
    },
    getRefPagination() {
      return this.$refs.pagination
    },
    // 页面切换事件  通过 @currentChange 绑定
    currentChange(val) {
      this.$emit('currentChange', val)
    },
    // 每页条数切换事件,通过@sizeChange 绑定
    sizeChange(val) {
      this.$emit('sizeChange', val)
    },
    handleSelectionChange(val) {
      this.$emit('selectionChange', val)
    }
  }
}
</script>
<style lang="scss" scoped>
.table-box {
  flex: 1;
  overflow: hidden;
  width: 100%;
  height: 100%;
}
</style>

再上父组件代码

<template>
  <div class="tableBox">
    <PublicTable
      ref="zhenDuanWHTable"
      class="table"
      :loading="loading"
      :current-page="searchParams.pageNum"
      :total="total"
      :page-size="searchParams.pageSize"
      :table-data="tableData"
      :table-info="tableInfo"
      :table-column="columns"
      :btn-button="operations"
      :events="events"
      operation-width="150px"
      @sizeChange="handleSizeChange"
      @currentChange="handleCurrentChange"
    />
  </div>
</template>

<script>
import tableInfo from './mixins/tableInfo.js'
import PublicTable from '@/components/PublicTable/index.vue'
export default {
  components: {
    PublicTable
  },
  mixins: [tableInfo],
  data() {
    return {}
  },
  methods: {}
}
</script>

<style lang="scss" scoped>
.tableBox {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 600px;
  .table {
    height: calc(100% - 48px);
  }
}
</style>

再上mixins/tableInfo.js代码

import mockData from './mockData'
export default {
  data() {
    return {
      // 获取列表前是否loading加载
      loading: false,
      // 搜索查询的参数
      searchParams: {
        pageNum: 1,
        pageSize: 10
      },
      // table数据源
      tableData: mockData,
      // 表格项绑定的属性
      columns: [
        {
          prop: 'title',
          label: '审核描述',
          minWidth: '100px',
          align: 'center',
          formatter: row => (row.title ? row.title : '暂无标题')
        },
        {
          prop: 'statusDesc',
          minWidth: '100px',
          align: 'center',
          label: '审核状态'
        },
        {
          prop: 'createBy',
          minWidth: '100px',
          align: 'center',
          label: '申请人'
        },
        {
          sortable: 'custom',
          prop: 'createdTime',
          minWidth: '100px',
          align: 'center',
          label: '申请时间'
        },
        {
          prop: 'auditBy',
          minWidth: '100px',
          align: 'center',
          label: '审核人'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'auditTime',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'A',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'B',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'C',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'D',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'E',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'E',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'E',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'E',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'E',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'E',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'E',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'E',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'E',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'E',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'E',
          label: '审核时间'
        },
        {
          minWidth: '100px',
          align: 'center',
          prop: 'E',
          label: '审核时间'
        }
      ],
      // 表格绑定的属性
      tableInfo: {
        stripe: true,
        'highlight-current-row': true // 选中行高亮
      },
      events: {
        'row-dblclick': row => {
          //双击表格项触发的函数
          console.log(row)
        },
        'row-click': row => {
          // 单机表格项触发的函数
          console.log('row', row)
        }
      },
      // 操作列
      operations: [
        {
          text: '编辑',
          isShow: row => true, // 是否展示
          isDisable: row => true, // 是否禁用
          type: 'text',
          class: 'el-text-color',
          callback: row => {
            this.handleAddOrEdit('edit', row)
          }
        }
      ],
      total: 0
    }
  },
  mounted() {},
  methods: {
    // 每也条数改变
    handleSizeChange(pageSize) {
      this.searchParams.pageSize = pageSize
    },
    // 改变页数
    handleCurrentChange(pageNum) {
      this.searchParams.pageNum = pageNum
    },
    handleAddOrEdit(type, row) {
      if (type === 'edit') {
        this.visible = true
        this.infoData = row
      }
    }
  }
}

假数据mockData(不用管)

export default [
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  },
  {
    title: 'A',
    statusDesc: 1,
    createBy: '甲',
    createdTime: '2023-01-01 23:59:59',
    auditBy: '乙',
    auditTime: '2023-01-02 23:59:59'
  }
]

最后附上效果图

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1086197.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Linux和UNIX的关系及区别

UNIX 与 Linux 之间的关系是一个很有意思的话题。在目前主流的服务器端操作系统中&#xff0c;UNIX 诞生于 20 世纪 60 年代末&#xff0c;Windows 诞生于 20 世纪 80 年代中期&#xff0c;Linux 诞生于 20 世纪 90 年代初&#xff0c;可以说 UNIX 是操作系统中的"老大哥&…

瑞芯微 | 如何固定以太口地址为指定ip?

rxw的RK3568的evb1公板&#xff0c;有2个以太口&#xff0c; 默认UI界面只能配置eth0&#xff0c;无法配置eth1&#xff0c; 实际应用中&#xff0c;有时需要一旦有网线插入&#xff0c;就需要该地址设置为指定IP地址。 本文介绍2个最简单的方法实现固定IP。 一、通过修改i…

电脑提示kernel32.dll的错误提示窗口怎么办,解决kernel32.dll丢的办法

当你在使用电脑时&#xff0c;突然收到kernel32.dll丢失或找不到的错误提示窗口&#xff0c;这个时候先不要让自己的心态爆炸&#xff0c;解决的办法会有很多种&#xff0c;其实问题都不大&#xff0c;就能够很好的解决文件缺失的问题。接下来就把方法推进给大家。 一.解决kern…

Docker逃逸---CVE-2020-15257浅析

一、产生原因 在版本1.3.9之前和1.4.0~1.4.2的Containerd中&#xff0c;由于在网络模式为host的情况下&#xff0c;容器与宿主机共享一套Network namespace &#xff0c;此时containerd-shim API暴露给了用户&#xff0c;而且访问控制仅仅验证了连接进程的有效UID为0&#xff…

网站列表页加密:三次请求后返回内容多\r

一、抓包第一次请求 url aHR0cDovL2N5eHcuY24vQ29sdW1uLmFzcHg/Y29saWQ9MTA抓包&#xff0c;需要清理浏览器cookie&#xff0c;或者无痕模式打开网址&#xff0c;否则返回的包不全&#xff0c;依照下图中的第一个包进行requests请求 第一次请求后返回 <!DOCTYPE html>…

每年高考时间是几月几号 高考开始时间

高考是高中生最重要的一个阶段&#xff0c;甚至影响着很多学生的未来&#xff0c;相信大家都很关注高考的具体时间是什么时候&#xff0c;本次将详细给您介绍高考的具体开始时间以及结束时间。 每年高考的时间都是6月7日开始&#xff0c;一共持续三天时间左右&#xff0c;但是…

Java面试题-0919

集合篇 Java面试题-集合篇HashMap底层实现原理概述javaSE进阶-哈希表 为了满足hashmap集合的不重复存储&#xff0c;为什么要重写hashcode和equals方法&#xff1f; 首先理解一下hashmap的插入元素的前提&#xff1a; hashmap会根据元素的hashcode取模进行比较&#xff0c;当…

HDLbits: Lemmings3

Lemmings又多了一种状态&#xff1a;dig&#xff0c;我按照上一篇文章里大神的思路又多加了两种状态&#xff1a;LEFT_DIGGING与RIGHT_DIGGING&#xff0c;写出了如下的代码&#xff1a; module top_module(input clk,input areset, // Freshly brainwashed Lemmings walk …

css中filter属性设置后导致页面定位失效

问题&#xff1a;app上设置css的filter属性导致定位失效。 原因&#xff1a;当在标签中使用了 filter 属性后&#xff08;body { filter: grayscale(1); &#xff09;&#xff0c; filter 就会生成一个新的包含块&#xff0c;其位置大小和所在标签一样&#xff0c;然后 fixed …

Java BIO模型分析(提供单线程和多线程服务端代码示例)

目录 一、BIO特点介绍二、BIO代码实现2.1、客户端代码准备2.2、服务端单线程处理2.2.1、服务端代码2.2.2、阻塞代码分析2.2.3、存在问题 2.3、服务端多线程处理2.3.1、服务端代码2.3.2、存在问题 一、BIO特点介绍 BIO(blocking I/O)&#xff1a;同步阻塞IO&#xff0c;在每个I…

day62:ARMday9,I2c总线通信

作业&#xff1a;按键中断实现LED1、蜂鸣器、风扇 key_in.c: #include "key_in.h"void gpio_init() {//RCC使能//GPIOERCC->MP_AHB4ENSETR | (0x1<<4);//GPIOBRCC->MP_AHB4ENSETR | (0x1<<1);//PE10、PB6、PE9输出模式GPIOE->MODER & ~(0…

经典面试题第八更---reduce的使用

前言&#xff1a; &#x1f921; 作者简介&#xff1a;我是Morning&#xff0c;计算机的打工人&#xff0c;想要翻身做主人 &#x1f648; &#x1f648; &#x1f648; &#x1f3e0; 个人主页&#xff1a; Morning的主页 &#x1f4d5;系列专栏&#xff1a;前端面…

ARM day9

src/key_it.c #include "key_it.h" #include "led.h" void key_it_config() {//RCC使能GPIOF时钟RCC->MP_AHB4ENSETR | (0x1<<5);//设置PF9 PF7 PF8GPIO输入//PF9GPIOF->MODER & (~(0x3<<18));//PF8GPIOF->MODER & (~(0x3&l…

Unity - Normal mapping - Reoriented normal mapping - 重定向法线、混合法线

文章目录 目的核心代码PBR - Filament - Normal mappingShader效果BlendNormal_Hill12BlendNormal_UDNBlendNormals_Unity_Native - 效果目前最好 ProjectReferences 目的 备份、拾遗 核心代码 half3 blended_normal normalize(half3(n1.xy n2.xy, n1.z*n2.z));PBR - Filam…

不是钉钉管理员如何批量复制公司全部人员名单到execl表格里

环境&#xff1a; Win10 专业版 钉钉V7.10.0 问题描述&#xff1a; 不是钉钉管理员,如何批量复制公司全员群里面全面人员名单 公司人员有388多个 解决方案&#xff1a; 1.打开公司全员群&#xff0c;右上角点开设置&#xff0c;点查看全部群成员 2.右侧成员一次复制几个&…

Vue-2.7自定义指令

自定义指令 自己定义的指令&#xff0c;可以封装一些dom操作&#xff0c;扩展额外功能 例如需求&#xff1a;当页面加载时&#xff0c;让元素将获得焦点&#xff08;autofucus在safari浏览器有兼容性&#xff09; 操作dom&#xff1a;dom元素.focus() 太麻烦&#xff01;…

datax同步数据简介

概述 业务中经常会用到数据全量同步和增量同步&#xff0c;用sqlDump只能全量同步&#xff0c;而且数据量大的时候很慢。 阿里的datax目前是一款不错的同步工具 环境要求&#xff1a; jdk:1.8 python:2.7 maven:3.0 3.0的python跑不起来 ps:开源版的datax的mysql驱动还是用…

“零代码”能源管理平台:智能管理能源数据

随着能源的快速增长&#xff0c;有效管理和监控能源数据变得越来越重要。为了帮助企业更好的管理能源以及降低能源成本&#xff0c;越来越多的能源管理平台出现在市面上。 “零代码”形式的能源管理平台&#xff0c;采用IT与OT深度融合为理念&#xff0c;可进行可视化、拖拽、…

【C语言】每日一题(半月斩)——day4

目录 选择题 1、设变量已正确定义&#xff0c;以下不能统计出一行中输入字符个数&#xff08;不包含回车符&#xff09;的程序段是&#xff08; &#xff09; 2、运行以下程序后&#xff0c;如果从键盘上输入 65 14<回车> &#xff0c;则输出结果为&#xff08; &…

RabbitMQ消息中间件概述

1.什么是RabbitMQ RabbitMQ是一个由erlang开发的AMQP&#xff08;Advanced Message Queue &#xff09;的开源实现。AMQP 的出现其实也是应了广大人民群众的需求&#xff0c;虽然在同步消息通讯的世界里有很多公开标准&#xff08;如 COBAR的 IIOP &#xff0c;或者是 SOAP 等&…