当前位置: 首页 > news >正文

个人网站的制作代码北京软件研发公司

个人网站的制作代码,北京软件研发公司,网络平台举报中心,免费做h5的平台本篇文章记录el-table增加一行可编辑的数据列#xff0c;进行增删改。 1.增加空白行 直接在页面mounted时对form里面的table列表增加一行数据#xff0c;直接使用push() 方法增加一列数据这个时候也可以设置一些默认值。比如案例里面的 产品件数 。 mounted() {this.$nextTi…本篇文章记录el-table增加一行可编辑的数据列进行增删改。 1.增加空白行 直接在页面mounted时对form里面的table列表增加一行数据直接使用push() 方法增加一列数据这个时候也可以设置一些默认值。比如案例里面的 产品件数 。 mounted() {this.$nextTick(() {this.addFormData.productList.push({productName: ,//产品名称price: ,//单价(元/㎡)productCount: 1, //产品件数totalAmount: , //小计元})})}, 2.产品名称选中拿到数据展示到列表行 因为当前案例的产品名是下拉选择的所以我们要请求接口拿到数据渲染到下拉列表这里直接使用了假数据。 data() {return {addFormData: {// 产品列表productList: [],},addFormRules: {productName: [{required: true,message: 请选择产品,trigger: blur}],price: [{required: true,message: 请输入单价,trigger: blur}],productCount: [{required: true,message: 请输入产品件数,trigger: blur}]},optionsList: [{id:1,productName:橘子,price:10,},{id:2,productName:苹果,price:8,}]}},el-form refaddFormRef :modeladdFormData :rulesaddFormRules sizemini :inlinetrueel-table tooltip-effectlight :dataaddFormData.productList el-table-column label产品名称 propproductName min-width150template slot-scopescopeel-form-item sizemini :propproductList. scope.$index .productName:rulesaddFormRules.productName classallel-select v-modelscope.row.productName filterable value-keyid placeholder请选择changepestChange($event, scope.$index)el-option v-foritem in optionsList :keyitem.id :labelitem.productName:valueitem/el-option/el-select/el-form-item/template/el-table-columnel-table-column label操作 aligncenter class-namesmall-padding fixed-width fixedrightwidth150template slot-scopescopeel-button sizemini typetext iconel-icon-edit clickhandleUpdateYes(scope.row)v-hasPermi[system:order:edit]增加/el-buttonel-button sizemini typetext iconel-icon-delete clickhandleDeleteProduct(scope.row)v-hasPermi[system:order:remove]删除/el-button/template/el-table-column/el-tableel-form-item sizelargeel-button typeprimary clickhandleSubmitAdd提交/el-buttonel-button clickhandleCancelAdd取消/el-button/el-form-item/el-formpestChange(e, index) {//此时的e 就是optionsList中的某一项//让后解构赋值给我们这一行对应的值 let data this.addFormData.productList[index]Object.keys(data).forEach(key {data[key] e[key]})this.addFormData.productList[index].productCount 1}, 3.小计通过(计算属性计算值) el-form refaddFormRef :modeladdFormData :rulesaddFormRules sizemini :inlinetrueel-table tooltip-effectlight :dataaddFormData.productList el-table-column label小计元 proptotalAmount width100template slot-scopescopediv classnotext{{ getTotalAmount(scope.row) }}/div/template/el-table-columnel-table-column label操作 aligncenter class-namesmall-padding fixed-width fixedrightwidth150template slot-scopescopeel-button sizemini typetext iconel-icon-edit clickhandleUpdateYes(scope.row)v-hasPermi[system:order:edit]增加/el-buttonel-button sizemini typetext iconel-icon-delete clickhandleDeleteProduct(scope.row)v-hasPermi[system:order:remove]删除/el-button/template/el-table-column/el-tableel-form-item sizelargeel-button typeprimary clickhandleSubmitAdd提交/el-buttonel-button clickhandleCancelAdd取消/el-button/el-form-item/el-form computed: {getTotalAmount(){return (data) {//先判断单价和数量必须存在if (data.productCount data.price) {data.totalAmount parseInt(data.productCount) * parseInt(parseFloat(data.price))return data.totalAmount} else {return 0.00}}}}, 4.再增加一行复用上一行的数据 handleUpdateYes(row) {//拿到上一行数据再往数组中push新的数据this.addFormData.productList.push({productName: row.productName,//产品名称price: row.price,//单价(元/㎡)productCount: row.productCount, //产品件数totalAmount: , //小计元})}, 5.删除某一行 // 删除产品handleDeleteProduct(row) {this.$confirm(此操作将永久删除该产品信息, 是否继续?, 提示, {confirmButtonText: 确定,cancelButtonText: 取消,type: warning}).then(() {this.$message({type: success,message: 删除成功!});this.addFormData.productList.splice(row.index, 1)}).catch(() {this.$message({type: info,message: 已取消删除});});}, 6.点击提交对表单校验 // 添加订单表单提交handleSubmitAdd() {this.$refs.addFormRef.validate(async (valid) {if (!valid) return//校验通过 往下执行})},
http://www.w-s-a.com/news/348852/

相关文章:

  • 小公司做网站用哪种服务器什么是网站代理
  • 青岛李村网站设计公司cms建站平台
  • 做saas网站可行吗许昌抖音推广公司
  • 网站建设找谁做seo基础知识培训
  • 微网站怎么做的好建设网站不会写代码
  • 广州外贸网站制作wordpress信息搜索插件
  • 福建高端网站建设个人公众号怎么制作教程
  • 企业网站有哪些举几个例子wordpress ie兼容插件
  • 高端的深圳网站页面设计福清市建设局官方网站
  • 安装网站到服务器合肥建设干部学校网站
  • 影视网站如何做销售案例网站
  • 建设网站对比方案龙岗网站开发公司
  • 网站开发标准网站建设公司兴田德润可信赖
  • 如何建设一个公众号电影网站自动seo优化
  • 个人网站能备案吗酱香拿铁采取了哪些网络营销方式
  • 网站建设及推广好做吗自己做的网站加入购物车价格
  • 涡阳在北京做网站的名人注册一个免费的网站
  • 三门峡建设环境局网站公司注册网上核名通道
  • 叶县建设局网站要看网海外域名是多少
  • 网站运行环境配置Wordpress支付时效
  • logo设计网站知乎港北网站建设
  • 北京市保障性住房建设投资中心官方网站有限责任公司的特点
  • 做网站卖互联网营销怎么做
  • 晋州市建设局网站建站网站系统
  • 专业网站优化方案广东微信网站制作报价表
  • 北京网站建设公司分形科技简述营销网站建设策略
  • 汉中网站建设有限公司vue网站开发
  • 网站备案背景幕布阳江东莞网站建设
  • 北京网站建设要多少钱html网站标签
  • 做兼职做网站的是什么公司网站怎么修改