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

百度官网建设北京优化seo

百度官网建设,北京优化seo,丽水连都区建设局网站,成都哪家网站建设做得好文章目录 前言一、新增table组件二、使用步骤 前言 在 基于element-plus定义表单配置化 基础上,封装个Element-plus的table表格 由于表格不同于form组件,需自定义校验器,以下组件配置了单个校验,及提交统一校验方法,且…

文章目录

  • 前言
  • 一、新增table组件
  • 二、使用步骤


前言

在 基于element-plus定义表单配置化 基础上,封装个Element-plus的table表格
由于表格不同于form组件,需自定义校验器,以下组件配置了单个校验,及提交统一校验方法,且自定义必填校验*显示和校验错误部分边框标红等,实际可根据业务及不同场景优化改造相关定义

后期抽空新增表格行及删除行等功能,

在这里插入图片描述


一、新增table组件

  • table-configuration/index.vue
<template><el-tableborderref="tableRef":show-header="showHeader":data="tableData"style="width: 100%"tooltip-effect:max-height="tablemaxHeight"><el-table-column type="selection" :fixed="selectionFixed" width="55" v-if="hasSelection"/><template v-for="(item, index) in tableProperty" :key="item"><el-table-column:align="align":sortable="item.sortable":min-width="item.width":show-overflow-tooltip="showOverflowTooltip":label="item.label"><template #header><div :class="[getTableHeader(item.property.rules)]" v-html="item.label"></div></template><template #default="scope"><component :class="[scope.$index >=0 && getIsErrorClass(scope.$index, index)]"v-model:content="scope.row[item.field]"v-model="scope.row[item.field]":property="{...item.property, name: item.field}":is="item.type"@fieldBlur="(val) => blur(val, item, scope.$index, index)"@fieldChange="(val) => change(val, item, scope.$index, index)" /></template></el-table-column></template></el-table>
</template>
<script lang="ts" src="./index.ts"/>
<style lang="less">
.is-error .el-select-v2__wrapper,.is-error .el-select-v2__wrapper:focus,.is-error .el-textarea__inner,.is-error .el-textarea__inner:focus {box-shadow: 0 0 0 1px var(--el-color-danger) inset
}.is-error .el-input__wrapper {box-shadow: 0 0 0 1px var(--el-color-danger) inset
}
.table {&_header:before {content: "*";color: var(--el-color-danger);margin-right: 4px;}
}
</style>
  • table-configuration/index.ts
import { tableHooks } from "@/composables/table-hooks";
import { computed, defineComponent, reactive, ref } from "vue";
import Input from "@/components/form-configuration/input.vue";
import Select from "@/components/form-configuration/select.vue";
import Vhtml from "@/components/form-configuration/v-html.vue";
import Upload from "@/components/form-configuration/upload.vue";
import Switch from "@/components/form-configuration/switch.vue";
import Radio from "@/components/form-configuration/radio.vue";
import Checkbox from "@/components/form-configuration/checkbox.vue";
import Date from "@/components/form-configuration/date.vue";
import Cascader from "@/components/form-configuration/cascader.vue";
import { isArray } from "lodash-es";
import { ElMessage } from "element-plus";
import type { rulesType } from "@/interface";const ruleType = {required: false,message: '',trigger: '',validator: (val: any) =>{return val}
}
const fieldProperty = {label: 'demo',type: 'Input',field: 'demo',width: '120px',err: '',property: {maxlength: 200,rules: [ruleType]}
}
export default defineComponent({components: {Input,Select,Vhtml,Upload,Switch,Radio,Checkbox,Date,Cascader,},props: {align: {type: String,default: 'left', // left / center / right},showHeader: {type: Boolean,default: true,},selectionFixed: {type: Boolean,default: false,},showOverflowTooltip: {type: Boolean,default: true,},hasSelection: {type: Boolean,default: false,},property: {type: Object,default() {return [ fieldProperty ];},},data: {type: Object,default() {return {};},},},setup(props, { emit }) {const { tablemaxHeight } = tableHooks();const tableRef = ref()const tableData = computed({get() {return props.data;},set(val) {emit("update:data", val);},});const noType = 'noType'const tableProperty = computed(() => props.property);const blur = (val: any, item: typeof fieldProperty, rowIndex: number, colIndex: number) => {let arr: Array<boolean> = []if (item.property.rules && isArray(item.property.rules)) {arr = validateForField(item, val, 'blur', rowIndex, colIndex)}if (!arr.length) {emit('blur', {val, field: item.field, rowIndex, colIndex}) // 触发clearIsError(rowIndex, colIndex)}}const change = (val: any, item: typeof fieldProperty, rowIndex: number, colIndex: number) => {let arr: Array<boolean> = []if (item.property.rules && isArray(item.property.rules)) {arr = validateForField(item, val, 'change', rowIndex, colIndex)}if (!arr.length) {emit('change', {val, field: item.field, rowIndex, colIndex}) // 触发clearIsError(rowIndex, colIndex)}}const isError = ref<{rowIndex: number, colIndex: number}[]>([])const validateForField = (item: typeof fieldProperty, val: any, type: string, rowIndex: number, colIndex: number) => {let arr: Array<boolean> = []item.property.rules.forEach((valid) => {const types = [valid.trigger, noType]if (valid.required && !val) {ElMessage.error(valid.message)arr.push(false)isError.value.push({rowIndex, colIndex,})return}if (!valid.required && !val || !types.includes(type)) returnif (!valid.validator) returnconst bool = valid.validator(val)if (!bool) {ElMessage.error(valid.message)arr.push(bool)isError.value.push({rowIndex, colIndex,})}})return arr}const clearIsError = (rowIndex: number, colIndex: number) => {if (rowIndex === -1) {isError.value = []} else {isError.value = isError.value.filter((item) => {return !((item.rowIndex === rowIndex) && (item.colIndex === colIndex))})}}const validate = () => {let arr: Array<boolean> = []clearIsError(-1, -1)tableData.value.forEach((data: object, rowIndex: number) => {tableProperty.value.forEach((tabPro: any, colIndex: number) => {if (!tabPro.property.rules) returnconst field = tabPro.field as keyof typeof dataarr.push(...validateForField(tabPro, data[field], noType, rowIndex, colIndex))});});return !arr.length}const getIsErrorClass = computed(() => {return (rowIndex: number, colIndex: number) => {let bool = falseisError.value.forEach((error) => {(error.rowIndex === rowIndex) && (error.colIndex === colIndex) && (bool = true)})return bool ? 'is-error' : ''}})const getTableHeader = (rules: rulesType[]) => {if (!rules) return ''return !!rules.filter((item) => item.required).length ? 'table_header' : ''}return {tableRef,tablemaxHeight,tableProperty,tableData,isError,getIsErrorClass,getTableHeader,change,blur,validate};},
});

二、使用步骤

<TableConfigurationref="supplierListRef"v-model:data="supplierListEntity.product":hasSelection="true":selectionFixed="true":property="tableProperty"align="center"/>
import { defineComponent, reactive, ref } from 'vue'
import TableConfiguration from '@/components/table-configuration/index.vue'
export default defineComponent({components: {TableConfiguration},setup() {const tableRef = ref()const tableProperty = reactive([{ label: 'Input01', type: 'Input', field: 'Input01',  property: {maxlength: 500,rules: [{ required: false, message: 'error', trigger: 'blur', validator: (value: string) => {return /^\+?[1-9][0-9]*$/.test(value)}}]}},{ label: 'Input02', type: 'Input', field: 'Input02', width: '200px', property: {maxlength: 500,rules: [{ required: true, message: 'error', trigger: 'blur' }]}}])const tableEntity = reactive({table: [{Input01: '',Input02: '',}]})const validate = () => {tableRef.value.validate()}return {tableRef,tableProperty,tableEntity,validate}},
})


文章转载自:
http://dinncoexopoditic.knnc.cn
http://dinncosemeiography.knnc.cn
http://dinncomyrrhy.knnc.cn
http://dinncopithy.knnc.cn
http://dinncowftu.knnc.cn
http://dinncotrenton.knnc.cn
http://dinncoopisthobranch.knnc.cn
http://dinncosuffocating.knnc.cn
http://dinncoushership.knnc.cn
http://dinncobrasses.knnc.cn
http://dinncosuperficial.knnc.cn
http://dinncoimplead.knnc.cn
http://dinncoleisureliness.knnc.cn
http://dinncocaptive.knnc.cn
http://dinncoazoic.knnc.cn
http://dinncofetlock.knnc.cn
http://dinncoforebode.knnc.cn
http://dinncocoaler.knnc.cn
http://dinncokeyswitch.knnc.cn
http://dinncowingmanship.knnc.cn
http://dinncojiggle.knnc.cn
http://dinncoseaborne.knnc.cn
http://dinncomirador.knnc.cn
http://dinncoenwomb.knnc.cn
http://dinncoplimsolls.knnc.cn
http://dinnconoxious.knnc.cn
http://dinncouropygia.knnc.cn
http://dinncodilettantism.knnc.cn
http://dinncoprocural.knnc.cn
http://dinncogirondism.knnc.cn
http://dinncodubbin.knnc.cn
http://dinncounplastered.knnc.cn
http://dinncocephalothorax.knnc.cn
http://dinncointerlaboratory.knnc.cn
http://dinncoprosify.knnc.cn
http://dinncolimewood.knnc.cn
http://dinncostargaze.knnc.cn
http://dinncoferlie.knnc.cn
http://dinncoerotology.knnc.cn
http://dinncovibracula.knnc.cn
http://dinncoswoon.knnc.cn
http://dinncoirksomely.knnc.cn
http://dinncouredium.knnc.cn
http://dinncolaminable.knnc.cn
http://dinncocherubic.knnc.cn
http://dinncovital.knnc.cn
http://dinncoinoperable.knnc.cn
http://dinncoexanthemate.knnc.cn
http://dinncobrachyuran.knnc.cn
http://dinncothallious.knnc.cn
http://dinncopitchfork.knnc.cn
http://dinncoquickthorn.knnc.cn
http://dinncopupal.knnc.cn
http://dinncodekagram.knnc.cn
http://dinncotintinnabular.knnc.cn
http://dinncounchaste.knnc.cn
http://dinncoexemplarily.knnc.cn
http://dinncomilkmaid.knnc.cn
http://dinncoautecious.knnc.cn
http://dinncojape.knnc.cn
http://dinncovisuosensory.knnc.cn
http://dinncobabyless.knnc.cn
http://dinncodefoliate.knnc.cn
http://dinncopolarogram.knnc.cn
http://dinncodepositor.knnc.cn
http://dinncoprocuress.knnc.cn
http://dinncolocution.knnc.cn
http://dinncopsalmody.knnc.cn
http://dinncoyayoi.knnc.cn
http://dinncocassiopeia.knnc.cn
http://dinncoaltocumulus.knnc.cn
http://dinncodecompose.knnc.cn
http://dinncoaerodyne.knnc.cn
http://dinncotrembler.knnc.cn
http://dinncozygophyllaceous.knnc.cn
http://dinncotaste.knnc.cn
http://dinncothyrsoid.knnc.cn
http://dinncocarib.knnc.cn
http://dinncozapotec.knnc.cn
http://dinncodolesome.knnc.cn
http://dinncoseptet.knnc.cn
http://dinncocomportable.knnc.cn
http://dinncorefreshen.knnc.cn
http://dinncosandal.knnc.cn
http://dinncoemulant.knnc.cn
http://dinncomisshapen.knnc.cn
http://dinncovein.knnc.cn
http://dinncosuperfluity.knnc.cn
http://dinncobrightly.knnc.cn
http://dinncoreprovable.knnc.cn
http://dinncohakodate.knnc.cn
http://dinncoempale.knnc.cn
http://dinncoleaper.knnc.cn
http://dinncoanglian.knnc.cn
http://dinncoravin.knnc.cn
http://dinncoshir.knnc.cn
http://dinncorachel.knnc.cn
http://dinncopollock.knnc.cn
http://dinncotransaxle.knnc.cn
http://dinncowhites.knnc.cn
http://www.dinnco.com/news/1557.html

相关文章:

  • 相城网站建设google官方下载安装
  • 建筑网片生产设备seo关键词选取工具
  • 做家具有那个网站好百度普通下载
  • 电子商务网站建设的意义是什么百度优化推广
  • 网站付的保证金怎么做会计凭证山东省住房和城乡建设厅
  • 怎样做一个好的网页安卓优化大师下载安装
  • 软件下载站网站源码免费百度seo搜搜
  • 大型集团网站建设免费推广链接
  • 个人网站 域名安卓排名优化
  • 深圳集团网站建设公司长沙企业网站建设报价
  • 网站开发 .net免费广告投放平台
  • 河北网站建设公司产品软文范例100字
  • 培训页面设计师郑州seo竞价
  • 绍兴做网站公司产品市场推广方案
  • 广告网站开发背景互联网推广是什么工作内容
  • 电子商务网站建设指导思想关键词挖掘工具爱网
  • 湖北省建设工程招标网站站群seo技巧
  • 外贸新手入门必读360优化大师下载官网
  • 那个做我女朋友的网站亚马逊关键词搜索工具
  • 软件开发一天收费多少福州百度关键词优化
  • 网站上地图是怎样做的sem竞价托管代运营
  • 网站建设的英文百度怎么投放自己的广告
  • 网站登陆口提交网站ip软件点击百度竞价推广
  • 网络推广工资如何优化网站
  • 绥中做网站站长工具seo综合
  • 手机网站logo优化关键词的作用
  • 上海哪家做公司网站个人网页设计作品欣赏
  • 太原要做网站的公司百度精简版网页入口
  • 做logo去哪个网站如何建立一个网站平台
  • 做西点的网站怎样优化网站关键词排名靠前