element-ui table组件化,重新封装

elementUI之table组件封装 阅读详情

1、话不多说先看效果

主要实现功能:筛选:输入框、下拉框、时间;表格适用:多选、序号、排序、自定义、开关、链接可跳转、输入框、图片、自定义操作按钮(部分页面需要每行显示按钮不用所以大家按需添加)、常规操作按钮(每行操作按钮都相同无其他需求)、设置行背景色、分页
在这里插入图片描述

2、本文部分原创,大框架是复制的https://blog.youkuaiyun.com/qq_37346639/article/details/115556605这个博客,因为懒的自己写😂,按照需求改为自己所需要格式

3、筛选组件代码

<template>
    <div>
      <ul class="row-list" v-if="screenConfig.searchShow">
        <li v-for="(item,index) in screenConfig.formItem" :key="index">
          <label v-if="item.type != 'operationBtn'">{{item.label}}:</label>
<!--          输入框-->
          <el-input v-if="item.type === 'input'" clearable v-model.trim="screenConfig.searchParams[item.prop]"
                    class="w215" size="small" :placeholder="item.placeholder"></el-input>
<!--          下拉框-->
          <el-select v-if="item.type === 'select'" filterable clearable v-model.trim="screenConfig.searchParams[item.prop]"
                     :placeholder="item.placeholder" size="small" :multiple="item.multiple" :filterable="item.filterable">
            <el-option v-for="selectItem in item.options" :key="selectItem[item.value]" :value="selectItem[item.value]"
                       :label="selectItem[item.leftLabel]" :disabled="selectItem.disabled">
              <span style="float: left">{{ selectItem[item.leftLabel] }}</span>
              <span style="float: right; color: #8492a6; font-size: 13px">{{ selectItem[item.rightLabel] }}</span>
            </el-option>
          </el-select>
<!--          时间选择器-->
          <el-date-picker v-if="item.type === 'datePicker'" clearable v-model="screenConfig.searchParams[item.prop]"
                          :type="item.dateType" size="small" :value-format="item.format" placeholder="请选择"
                          range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
          </el-date-picker>
<!--          自定义-->
          <slot v-if="item.type == 'custom'" name='customFilter'></slot>
          <!--          按钮-->
          <span v-if="item.type == 'operationBtn'" v-for="(operations, index) in item.operation" :key="index">
						<el-button v-if="operations.isShow" :type="operations.btnType"  :icon="`iconfont ${operations.icon}`"
                       @click="screenBtn(operations)" class="screen-btn" :disabled="operations.disabled"
                       size="mini">{{operations.label}}
            </el-button>
					</span>
        </li>
      </ul>
    </div>
</template>

<script>
  export default {
    name: "PublicFilter",
    props: {
      screenConfig: {
        type: Object,
        required: true
      },
    },
    data() {
      return {};
    },
    methods: {
      // 操作按钮
      screenBtn(data) {
        this.$emit("screenBtn",data)
      }
    },
  }
</script>

<style scoped lang="less">
.screen-btn {
  margin-right: 10px;
}
.row-list {
  li{
    margin-bottom: 15px;
    float: left;
    margin-right: 15px;
    min-height: 32px;
    line-height: 32px;
  }
}
</style>


4、表格组件代码

<template>
  <div>
    <el-table size="medium" :data="tableData" :stripe="false" :border="false" :fit="true"
              :header-cell-style="{background:columnObj.headerBgColor,color: columnObj.headerColor,height: columnObj.headerHigh}"
              :highlight-current-row="columnObj.highlight" :row-class-name="tableRowClassName"
              @row-click="rowClick" :row-style="tableRowStyle"  @sort-change="sortChange">
      <!-- 选择框是否开启,selectable控制是否单行禁用 -->
      <el-table-column v-if="columnObj.selection" type="selection" :selectable="selectable" :align="columnObj.align || 'center'"></el-table-column>
      <el-table-column v-if="columnObj.serialNumber" type="index" label="序号" :align="columnObj.align || 'center'" width="50"></el-table-column>
      <!-- 普通列 -->
      <el-table-column v-for="(column,columIndex) in columnObj.columnData" :key="columIndex" :prop="column.prop"
                       :label="column.label" :width="column.width" :fixed="column.fixed" :align="columnObj.align || 'center'"
                       :sortable="column.sortable" :index="columIndex" show-overflow-tooltip>
        <template slot-scope="{row,$index}">
          <!-- 默认展示 -->
          <span v-if="column.type == 'text'" :style="{color:row[column.colorName]}">
            {{row[column.prop]}}
          </span>
          <!-- 标签类型 -->
          <span v-if="column.type == 'tag'">
            <el-tag :type="row[column.tagType]">{{row[column.prop]}}</el-tag>
          </span>
          <!-- 自定义内容 -->
          <slot v-if="column.type == 'ownDefined'" name='ownDefined' :row="row,column"></slot>
          <!-- switch开关 -->
          <el-switch v-if="column.type == 'switch'" v-model="row[column.prop]"
                     :inactive-text="row[column.prop] ? column.openText:column.closeText"
                     @change="switchChange(row,$index,column.prop)"></el-switch>
          <!-- 图片展示 -->
          <el-image v-if="column.type == 'image'" style="width: 50px; height: 50px" :src="row[column.prop]" fit="cover" :preview-src-list="[row[column.prop]]"></el-image>
<!--          url-->
          <div v-if="column.type == 'url'">
            <a v-if="row[column.urlName]" :href="row[column.urlName]"  target="_blank" class="url">{{row[column.prop]}}</a>
            <span v-else>{{row[column.prop]}}</span>
          </div>
          <!-- 可编辑-->
          <el-input v-if="column.type == 'editRow'" v-model="row[column.prop]" :disabled="row[column.editRow]"
                    @blur="editInputBlur(row,$index,column.prop,columIndex)" size="mini"></el-input>
<!--           自定义操作按钮,每行不一样-->
          <span v-if="column.type == 'customAction'" v-for="(operations, index) in row[column.prop]" :key="index">
						<el-button v-if="operations.isShow" type="text"
                       @click="rowOperation(row,$index,operations.type)" :style="{color:operations.color}"
                       size="small">{{operations.label}}
            </el-button>
					</span>
<!--           常规操作按钮-->
          <span v-if="column.type == 'routineAction'" v-for="(operations, index) in column.operation" :key="index">
						<el-button v-if="operations.isShow" type="text"
                       @click="rowOperation(row,$index,operations.type)" :style="{color:operations.color}"
                       size="small">{{operations.label}}
            </el-button>
					</span>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <div class="page_div" :style="{textAlign: pageObj.position || 'center'}" v-if="pageObj.show">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                     :hide-on-single-page="false" :current-page="pageObj.pageNo" :pager-count="7"
                     :page-sizes="[10, 15, 20, 30,50]" :page-size="pageObj.pageSize" background
                     layout="total,sizes,prev, pager, next" :total="pageObj.total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'public-table',
    props: {
      tableData: {
        type: Array,
        required: true
      },
      columnObj: {
        type: Object,
        required: true
      },
      pageObj: {
        type: Object,
        required: true
      }
    },
    data() {
      return {
      }
    },
    methods: {
      // 控制单行是否可用
      selectable(row, index) {
        if (row.switchs) {
          return true;
        }
        this.$emit("selectable", row, index)
      },
      // 操作按钮
      rowOperation(row, $index, now) {
        this.$emit("rowOperation", row, $index, now)
      },
      // switchChange调用
      switchChange(row, $index, prop) {
        this.$emit("switchChange", row, $index, prop);
      },
      // 行样式
      tableRowStyle({row}) {
        if(row.styleData) {
          return {'background': `${row.styleData.bgColor}`,'color':`${row.styleData.fontColor}`};
        }
      },
      // 行的 className 的回调方法
      tableRowClassName({row, rowIndex}) {
        row.rowIndex = rowIndex;
      },
      // 点击行
      rowClick(row, column, event) {
        this.$emit("rowClick", row, column, event);
      },
      // 可编辑input失去焦点
      editInputBlur(row, $index, prop, columIndex) {
        this.$emit('editInputBlur', row, $index, prop, columIndex);
      },
      // 远程排序
      sortChange({column, prop, order}) {
        // ascending上    descending下
        this.$emit('sortChange', column, prop, order);
      },
      // 条数变化
      handleSizeChange(e) {
        this.$emit('handleSizeChange', e);
      },
      // 页码变化
      handleCurrentChange(e) {
        this.$emit('handleCurrentChange', e);
      }
    }
  }
</script>
<style lang="less" scoped>
  .el-button {
    margin: 0 6px;
  }
  .page_div {
    padding: 15px 0;
  }
  .url {
    color: #3d8de0;
    cursor: pointer;
  }
  /deep/.el-table__body tr.current-row>td.el-table__cell {
    background-color: #a8b9cc;
  }
  /deep/.el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell {
    color: #606266;
  }
</style>


5、全局引入组件
main.js页面全局引入组件或单页面引入看需求,我是全局引入

import { PublicTable,PublicFilter } from '@/components';

Vue.component(PublicTable.name,PublicTable);
Vue.component(PublicFilter.name,PublicFilter);

文件目类
在这里插入图片描述
components>index.js

import PublicTable from '@/components/PublicTable';
import PublicFilter from '@/components/PublicFilter';

export {
  PublicTable,PublicFilter
};

6、父组件使用

<template>
  <div class="box">
    <el-card shadow="never">
      <public-filter :screenConfig="screenConfig" @screenBtn="screenBtn">
        <template  slot='customFilter'>
          <el-radio-group v-model="screenConfig.searchParams.aaa" class="radio">
            <el-radio :label="3">备选项</el-radio>
            <el-radio :label="6">备选项</el-radio>
            <el-radio :label="9">备选项</el-radio>
          </el-radio-group>
        </template>
      </public-filter>
    </el-card>
    <el-card shadow="never" class="mt-20">
      <public-table :tableData="tableData" :columnObj="columnObj" :pageObj="pageObj" @rowOperation="rowOperation"
                   @switchChange="switchChange" @editInputBlur="editInputBlur" @rowClick="rowClick"
                    @sortChange="sortChange"
                   @handleSizeChange="handleSizeChange" @handleCurrentChange="handleCurrentChange">
        <template slot='ownDefined' slot-scope="{row,column}">
          <p>
            <span v-if="row.names" :class="`iconfont ${row.names.icon}`" :style="{fontSize: row.names.fontSize,color: row.names.color}"></span>
            {{row.name}}
          </p>
          <p>{{row.address}}</p>
        </template>
      </public-table>
    </el-card>
  </div>
</template>
<script>

  export default {
    data() {
      return {
        // 筛选配置
        screenConfig:{
          searchShow: true, //筛选是否显示
          formItem: [{
            type: "input",
            prop:'input',
            label: "姓名",
            placeholder:'请输入姓名'
          }, {
            type: "select",
            prop: "parkingType",
            label: "类型",
            value:"id",
            leftLabel:"name",
            rightLabel:"gender",
            multiple: false,
            filterable: true,
            options: [{
              id: '1',
              name: '张三',
              gender: '男',
            },{
              id: '2',
              name: '李四',
              disabled: true
            },{
              id: '3',
              name: '李四',
              gender: '女',
            }],
            placeholder:'请选择数据'
          }, {
            type: "datePicker",
            prop: "data",
            label: "导出时间",
            format: "yyyy-MM-dd", //数据格式'yyyy-MM-dd'、timestamp(时间戳)
            dateType: "datetimerange", //显示类型(常用类型daterange、date、datetime) year年、month月、date日期、dates多个日期、 week周、datetime日期和时间点、datetimerange日期和时间范围、 daterange日期范围、monthrange月份范围
            placeholder: '请选择',
          }, {
            type: "custom",
            prop: "aaa",
            label: "自定义筛选",
          }, {
            type: "operationBtn",
            prop: "data",
            operation: [{
              btnType: "primary", //primary蓝色、success绿色、warning橘黄、danger红色、 info灰色、text文本
              type: 'cx',
              label: "查询",
              isShow: true,
              disabled: false,
              icon: 'icon-cry',
            },{
              btnType: "danger", //primary蓝色、success绿色、warning灰色、danger橘黄、 info红色、text文本
              type: 'cz',
              label: "重置",
              isShow: true,
              disabled: true,
              icon:'icon-atm-away'
            }]
          }]
        },
        // 表头配置
        columnObj: {
          selection: true,// 选择框
          serialNumber: true,// 序号
          highlight: false,// 当前行是否高亮
          align: 'center',// 对齐方式
          headerBgColor: '',// 表头背景色
          headerColor: '',// 表头字体颜色
          headerHigh: '55px',// 表头高
          // columnObj
          // selection(是否有多选框):true显示,false隐藏
          // serialNumber(是否有序列号):true显示,false隐藏
          // align(行文字对其方式):left左,right右,center居中
          // highlight(当前行是否高亮)
          // headerColor(表头字体颜色)
          // headerHigh(表头高):小于55px没有效果
          // columnObj>columnData
          //type(列类型):text文本,ownDefined自定义 ,switch开关,url链接,editRow可编辑,image图片,customAction自定义操作,routineAction常规操作
          //prop(参数),label(列名),width(宽度)
          //sortable(是否支持排序):true开启排序,false关闭排序'custom'远程排序
          //openText,closeText(开关开启/关闭名称),urlName(url地址对应参数):参数为空时只展示文字不可跳转
          //editRow(当前行是否可编辑和type为editRow对应):false可编辑,true不可编辑
          //colorName 控制文字颜色字段名
          columnData: [{
            type:'text',
            prop: "school",
            label: "默认样式",
            width: "",
            colorName: "color",
          }, {
            type:'tag',
            prop: "tag",
            tagType: "tagType",
            label: "标签类型",
            width: "",
          }, {
            type:'text',
            prop: "id",
            label: "可以排序",
            width: "",
            sortable: true,
          }, {
            type:'ownDefined',
            prop: "aaa",
            label: "自定义内容",
            width: "",
          }, {
            type:'switch',
            prop: "switchs",
            label: "switch开关",
            width: "",
            openText: "打开", //type='switch' 打开时的文字描述
            closeText: "关闭", //type='switch' 关闭时的文字描述
          }, {
            type:'url',
            prop: "name2",
            label: "可跳转",
            urlName: "url", //type='url',跳转地址名称(按需返回)
            width: "",
          }, {
            type:'editRow',
            prop: "name",
            label: "可编辑",
            width: "",
            editRow: 'editRow',
          },{
            type:'image',
            prop: "img",
            label: "图片",
            width: "",
          }, {
            type:'customAction',
            label: "自定义操作",
            width: "180",
            prop: "operation",
          }, {
            type:'routineAction',
            label: "常规操作",
            width: "180",
            operation: [{
              type: "cg",
              label: "常规",
              color: '',
              isShow: true,
            }]
          }],
        },
        // 表格数据
        // editRow(可编辑行是否可操作true/false)
        // styleData(Object类型,行样式,背景色、字体颜色等)
        //operation(Array类型,表头type=‘customAction’时按钮配置):type类型,label按钮名,color按钮颜色,isShow是否显示(true/false),
        // tagType标签类型(success绿/info灰/warning橘黄/danger红/)返回空为默认值蓝色
        tableData: [{
          id: '1',
          school: '北京大学',
          name: '王小虎',
          tag: '标签一',
          tagType: 'success',
          names:{
            name: '王小虎',
            icon:'icon-phone',
            fontSize: '15px',
            color:"red",
          },
          editRow: true,
          address: '上海市普陀区金沙江路 1518 弄',
          switchs: true,
          img: '',
          name2: '张三',
          icon: 'icon-phone',
          // 行样式
          styleData: {
            bgColor: '#878787',
            fontColor: '#fff',
          },
          operation: [{
            type: "edit",
            label: "编辑",
            color: '#be147d',
            isShow: true,
          }, {
            type: "delete",
            label: "删除",
            color: 'red',
            isShow: false,
          }, {
            type: "see",
            label: "查看",
            color: '#d77000',
            isShow: true,
          }],
        }, {
          id: '2',
          school: '天津大学',
          name: '王小虎',
          tag: '标签二',
          tagType: '',
          names:{
            name: '王小虎2',
            icon:'icon-cry',
            fontSize: '18px',
            color:"blue",
          },
          address: '上海市普陀区金沙江路 1517 弄',
          switchs: true,
          img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
          name2: '李四',
          url:'https://www.baidu.com/',
        }, {
          id: '3',
          school: '北京体育',
          tag: '标签三',
          tagType: 'info',
          color: 'red',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄',
          switchs: false,
          name2: '王五',
          img: '',
          operation: [{
            type: "edit",
            label: "编辑",
            color: '#67C23A',
            isShow: true,
          }, {
            type: "delete",
            label: "删除",
            color: 'red',
            isShow: true,
          }, {
            type: "see",
            label: "查看",
            color: '',
            isShow: true,
          }]
        }, {
          id: '4',
          school: '河北师范大学',
          name: '王小虎',
          tag: '标签四',
          tagType: 'warning',
          address: '上海市普陀区金沙江路 1516 弄',
          switchs: true,
          name2: '赵六',
          url:'https://www.baidu.com/',
          img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        }],
        //分页配置
        pageObj: {
          show: true, //是否显示
          position: "right", //位置
          total: 100,
          pageNo: 1,
          pageSize: 10
        },
      }
    },
    created(){
      this.$set(this.screenConfig,'searchParams',{})
    },
    methods: {
      screenBtn(data) {
      },
      rowOperation(row, $index, now) {
        console.log(row, $index, now)
      },
      switchChange(row, $index, prop) {
        console.log(row, $index, prop)
      },
      rowClick(row, column, event) {
        // 点击行触发,编辑点击的所在列,排除selection选择框
        // if (column.type != 'selection') {
        //   this.columnObj.columnData[column.index].editRow = row.rowIndex;
        // }
      },
      sortChange(column, prop, order) {
        // console.log(column, prop, order)
      },
      editInputBlur(row, $index, prop, columIndex) {
        // console.log(row, $index, prop, columIndex)
        // this.columnObj.columnData[columIndex].editRow = -1;
      },
      //页码变化
      handleCurrentChange(e) {
        this.pageObj.pageNo = e;
      },
      //条数变化
      handleSizeChange(e) {
        this.pageObj.pageSize = e;
        this.pageObj.pageNo = 1;
      },
    },
  }
</script>
<style>
.box {
  background: #f4f4f4;
  padding: 2% 1%;
  box-sizing: border-box;
}
</style>


el-table封装 vue2基于elementui进行的二次封装 el-table封装,超级好用~~ 阅读详情

相关推荐

封装Element-table

后台管理的表格封装,高效搬砖!直接可以拿来用,或者是自己可以改改,绝对适用大部分后台的表格,再次做个记录,也方便自己以后方便随取随用... ,el-pagination其中有一个分切切换,就是简单封装一下引入就行了。

weixin_59165883的博客 564

elementui-table封装

总的来说就是把table的表头改成动态数据渲染,调用的时候将表头数据和表格数据传给ExTable子组件渲染, 不用一行一行的写el-table-column,每列都可以自定义需要的参数还是很方便的,另外还可以加上分页,加上自定义组件 根据render修改列数据展示内容。

zhcinit0的博客 1160

Vue+Element UI表格可编辑组件封装实战

在Vue.js前端开发中,表格数据编辑是管理系统的高频需求。通过动态组件和响应式状态管理,可以构建可复用的表格编辑组件。Element UI的el-table组件结合Vue的composition API,能够实现包括文本输入、下拉选择、日期选择等多种编辑类型。这种组件化方案可降低60%以上的代码重复率,特别适合ERP、CRM等后台系统开发。技术实现上采用高阶组件模式,支持三层数据验证体系和性能优化措施,在万级数据量下仍能保持流畅交互。

weixin_30781433的博客 334

基于element ui封装table组件

以上就是基于element ui封装table组件。1.封装表格代码如下。

m0_58565372的博客 2199

Vue项目实战:给老el-table添加avue同款列筛选功能(附完整代码)

本文详细介绍了如何在Vue项目中为el-table添加类似avue的列筛选功能,包括动态列渲染控制、状态持久化和性能优化等核心实现。通过v-if指令和el-checkbox-group实现无感知刷新和用户偏好记忆,提供完整代码示例,助力开发者提升后台管理系统表格的交互体验。

weixin_28040125的博客 101

优化Element UI中el-popover动态内容定位:图片加载后的精准调整策略

本文针对Element UI中el-popover组件展示动态图片时出现的定位偏移问题,提供了精准的解决方案。核心在于通过监听图片的load事件,在图片加载完成后调用updatePopper()方法,从而触发弹窗位置的重计算,有效解决因内容尺寸异步变化导致的定位不准或图片溢出问题。

weixin_28025327的博客 248

Element-UI对Table表格的简单封装

问题描述:我们再开发中有时候会遇到相同功能表格,这个时候会将表格进行封装拆分处理。这里暂时记录一下简单的封装,加上一些必要的属性,其他属性有需要再加上去。 1,Table子组件 <template> <div class="TableGrid"> <el-table header-row-class-name="table-list-header" row-class-name="table-list-row" :max-heig

qq_44552416的博客 2891

Element Plus表格图片放大:从ElImage到自定义指令的完整实现方案

在前端开发中,图片预览是提升用户体验的常见需求,尤其在后台管理系统和数据表格场景下。其核心原理是通过监听用户交互事件(如鼠标悬停),动态计算并渲染一个独立于原布局的浮层,以展示高分辨率图片。这项技术能显著提升信息获取效率,广泛应用于电商商品管理、内容审核、数据仪表盘等需要快速查看图片细节的界面。本文聚焦于Vue 3和Element Plus技术栈,深入探讨如何在el-table组件中实现高性能、体验优雅的图片悬停放大功能。通过分析ElImage组件特性、结合ElPopover实现动态定位,并进一步封装为可复

cuixie2370的博客 390

vue2+element-UI表格封装

针对表格进行封装,在列表页面直接传入字段数组就可以展示数据表

sinat_24328329的博客 85

基于 Python 的 LIF 模型:探索神经元同步与小世界网络

首先,我们定义了一个LIFNeuronself.soma.L = self.soma.diam = 12.6157 # 固定神经元形状self.cm = cm # 电容self.V_rest = V_rest # 静息电位self.V = V_rest # 初始化膜电位在初始化过程中,每个神经元被赋予初始的静息电位,并且其膜电位会在后续的模拟过程中动态变化。

qq_36224726的博客 1428

【python爬虫实战】Python 抓取京东商品信息与评论,做竞品分析

本项目通过爬取京东平台商品数据,实现了完整的电商竞品分析流程。文章首先介绍了项目目标和技术栈,包括Python、Requests、BeautifulSoup等工具。然后详细解析了京东页面结构,包括商品列表页、详情页和评论页的特点。核心部分展示了商品列表爬取、评论数据获取以及竞品分析三个关键步骤的代码实现,每部分都包含运行结果和原理讲解。通过情感分析和关键词提取,项目能够对比不同产品的用户评价差异。最后,文章还讨论了合规性考量、优化建议和常见问题解答。该方案不仅适用于市场调研,也为企业制定营销策略提供了数据支

2503_91057718的博客 1万+

封装一个优雅的element ui表格组件

现在做后台系统用vue + elementUI 的越来越多,那element ui的 el-table 组件肯定也离不开。虽然element ui的table组件很好。但是表格和分页是分离的。每次写表格的时候都要写分页。这个就比较麻烦了。那我们可不可以把表格和分页封装在一起呢?照这个思路那我们重新封装一个带分页的表格。 思路: 表格组件...

weixin_33705053的博客 1294

Vivado ChipScope Debugging: Overcoming Common DRC Errors in FPGA Design

本文深入解析Vivado ChipScope调试中常见的DRC错误,特别是AVAL-244和AVAL-245等时钟相关问题,提供实用的Tcl命令解决方案和最佳实践。通过将DRC错误降级为警告的技巧,帮助FPGA设计者高效完成调试流程,同时强调何时应保留DRC检查以确保设计可靠性。

weixin_30335575的博客 418

Vue-Element

我们前端页面中的数据,如下图所示的表格中的学生信息,应该来自于后台,那么我们的后台和前端是互不影响的2个程序,那么我们前端应该如何从后台获取数据呢?因为是2个程序,所以必须涉及到2个程序的交互,所以这就需要用到我们接下来学习的Ajax技术。Ajax: 全称Asynchronous JavaScript And XML,异步的JavaScript和XML。与服务器进行数据交换:通过Ajax可以给服务器发送请求,并获取服务器响应的数据。异步交互:可以在不重新加载整个页面的情况下,与服务器交换数据并。

一同进步 775

关于DHCP Option60的认识

<br />       最近在网络建设过程中,必须面对一个实际存在的问题:当只有一根线入户时,该如何解决CATV和宽带业务的共存呢?这时就要考虑用到DHCP Option60了,那么DHCP Option60到底是如何来实现业务区分的呢?<br />首先先来看下DHCP协议,在DHCP协议中,定义了一个option字段,该字段主要是用来扩展DHCP协议的,Option 60 (Vendor class identifier)是DHCP报文中的一个选项字段,code为60,可以标识终端类型,根据不同的终

luoyingchuan的专栏 7940

PWM与光耦的完美联姻:低成本4-20mA转换方案揭秘

本文揭秘了PWM与光耦结合的低成本4-20mA转换方案,适用于工业自动化领域。通过PWM信号控制输出电流,光耦实现电气隔离,该方案成本低廉、电路简单且隔离可靠。文章详细介绍了两种经典电路实现方案,包括四光耦线性模式方案和PWM控制LM317方案,并提供了实战技巧与优化策略,帮助中小企业和电子DIY爱好者构建经济高效的4-20mA转换系统。

weixin_29229055的博客 539

揭秘Element Plus:Vue 3企业级UI库的架构设计与实战应用

在Vue 3生态系统中,Element Plus作为最受欢迎的企业级UI组件库之一,正重新定义现代Web应用开发体验。这个基于Vue 3的UI库不仅继承了Element UI的经典设计理念,更在TypeScript支持、Composition API集成和性能优化方面实现了质的飞跃。 ## 企业开发中的UI组件困境与Element Plus的解决方案 在企业级应用开发中,开发者常常面临这样的挑

gitblog_00094的博客 449

STM32单片机:驱动ADS1115四个通道全开程序

本文介绍了德州仪器(TI)的ADS1115高精度16位模数转换器(ADC)及其应用实现。该芯片具有16位分辨率、可编程增益放大器(PGA)和低功耗特性,支持±0.256V至±6.144V量程。文章提供了完整的C语言驱动代码,包括初始化、配置寄存器读写、单次/连续转换模式设置、电压值读取等功能实现。代码通过I2C接口与ADS1115通信,支持多通道选择和不同PGA设置,可实现高精度模拟信号采集。该方案适用于需要精密测量的嵌入式系统,如传感器数据采集等应用场景。

weixin_42122070的博客 691

全网最强JavaWeb笔记 | 万字长文爆肝JavaWeb开发——day03_Vue_Element

万字长文爆肝黑马程序员2023最新版JavaWeb教程。这套教程打破常规,不再局限于过时的老套JavaWeb技术,而是与时俱进,运用的都是企业中流行的前沿技术。笔者认真跟着这个教程,再一次认真学习一遍JavaWeb教程,温故而知新,对JavaWeb开发也有了更加深入细致的了解。因此笔者做了全网最全面详细的学习笔记,通篇图文并茂,

qq_45832461的博客 1835

pytest-bdd封装

简介 pytestbdd主要是用于代码封装 代码封装的好处: 1、提升代码复用率 2、提示测试效率 手工测试–使用框架0代码 流程+数据驱动 产品经理这样的不懂测试的人员–流程驱动 自动化测试–数据驱动 pytest-bdd:流程驱动封装 行为驱动–敏捷开发模式,消除开发/测试对需要了解的歧义 使用方式: 描述需求/用户场景 Feature(需求) Scenario(场景) Given(假设) When(操作步骤) Then(验证,清除) #新建feature 文件之前 需要提取安装支持featrue文.

liao_11的博客 2734

复现:Mamba-UNet:降水临近预报的创新解决方案

Mamba-UNet通过其创新的双分支Mamba融合模块、多尺度时空注意力模块和动态分位数加权损失函数,在降水临近预报领域取得了显著的性能提升。它不仅在多种降水场景下表现出色,尤其在预测强降水事件方面展现出了强大的能力。这一创新模型为降水临近预报提供了一种新的解决方案,有望在未来的研究和应用中发挥更大的作用,为应对气候变化带来的挑战提供有力支持。随着技术的不断发展和优化,我们期待Mamba-UNet在更广泛的气象预报任务中发挥更大的价值,为各行各业提供更精准、更可靠的降水预报服务。

hanfeng5268的博客 916

element UI实现动态生成多级表头

一、效果图 二、封装两个组件,分别为DynamicTable.vue和TableColumn.vue,TableColumn.vue主要是使用递归来对表头进行循环生成 DynamicTable.vue 1 <template> 2 <el-table :data="tableData" border :height="height"> 3 ...

weixin_30409849的博客 1001

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

现代C++终端UI库FTXUI:从声明式组件到实战任务管理器开发

在C++开发中,构建命令行界面(CLI)和终端用户界面(TUI)是提升工具交互性和用户体验的关键。传统的ncurses库虽然功能强大,但其过程式API和繁琐的屏幕管理方式,使得开发现代、动态的终端应用颇具挑战。现代C++(C++17及以上)通过引入函数式编程范式和更强大的类型系统,为声明式UI开发提供了可能。FTXUI(Functional Terminal User Interface)正是基于这一理念构建的头文件库,它采用组件化模型和声明式语法,将开发者从手动管理光标和刷新的细节中解放出来,极大地提升了

dengkuituo0680的博客 432

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

vue菜品管理

【代码】vue菜品管理。

2401_87471892的博客 27

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

SpringBoot+Vue高校实习管理系统全栈开发实战与源码解析

在当今企业级Web应用开发领域,前后端分离架构已成为主流范式,其核心在于通过清晰的职责划分提升开发效率和系统可维护性。SpringBoot作为后端开发的利器,通过自动配置和约定大于配置的原则,让开发者能快速构建稳健的RESTful API服务。Vue.js作为渐进式前端框架,凭借其响应式数据绑定和组件化特性,极大地优化了用户界面的开发体验。这种技术组合的价值在于能够高效应对如高校实习信息管理这类具有多角色、复杂业务流程的实际需求。实习管理系统涉及学生、教师、企业和管理员多方协作,传统管理方式存在信息孤岛与流

weixin_30635053的博客 383

JavaScript

编写视图。v-model:绑定数据模型message,message中的数据模型会在输入框中展示出来,因为v-model的双向绑定特性。例:AjaxAsynchronous Javascript And XML,异步的JavaScript和XML。数据交互:通过Ajax可以给服务器发送请求,并获取服务器响应的数据。异步交互:可以在不重新加载整个页面的情况下,与服务器交互数据并更新部分网页,如:搜索联想、用户名是否可以校验等等。同步和异步原生Ajax用于和服务器交换数据。向服务器发送请求。

2301_80112070的博客 1114
上一篇: 前端常用组件库
下一篇: 修改el-select 右侧图标样式和边框颜色
前端小小白~
博客等级 码龄7年 16粉丝 24原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值