当前位置:网站首页>Bgy development small example
Bgy development small example
2022-07-25 02:58:00 【Cicadas haven't slept yet】
One , Modify the corresponding data with different resolutions
onMounted(() => {
redirectPage()
})
const redirectPage = () => {
if (screen.width >= 1900) {
state.percentNum = '40%'
} else {
state.percentNum = '70%'
}
}Two 、 modify elementui Scroll bar size modification for
In a scss In file :
::-webkit-scrollbar {
width: 4px;
height: 4px;
}
::-webkit-scrollbar-track,
::-webkit-scrollbar-thumb {
border-radius: 999px;
/* border: 10px solid transparent; */
}
::-webkit-scrollbar-track {
/* box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2) inset; */
background: #f2f3f8;
}
::-webkit-scrollbar-thumb {
min-height: 10px;
background: #cdcdcd;
background-clip: content-box;
/* box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.2) inset; */
}
::-webkit-scrollbar-corner {
background: transparent;
}
::-webkit-scrollbar-thumb:hover {
background: #a8a8a8;
}3、 ... and 、elementui Form validation failed , Scroll to the no pass position
if (valid) {
console.log(' Verification passed ', valid)
} else {
console.log(' Verification failed !!')
const errorDiv = document.getElementsByClassName('is-error')
errorDiv[0].scrollIntoView({// Scroll to the specified node
block: 'center', // Value has start,center,end,nearest, Currently displayed in the middle of the view area
behavior: 'smooth', // Value has auto、instant,smooth, Slow motion animation ( It's slow at the moment )
})
return false
}Four 、 Recursive implementation of multi-level

5、 ... and 、elementui Form validation of forms
<el-form ref="dailogFormRef" :model="dailogForm" :rules="daiRules">
<el-table :data="dailogForm.gridData">
<el-table-column prop="quantity" label=" The amount of work " width="200" align="center">
<template #header>
<span> The amount of work </span>
<br />
<span>(B)</span>
</template>
<template #default="scope">
<el-form-item
label=" "
:prop="`gridData.${scope.$index}.quantity`"
:rules="daiRules.quantity"
>
<el-input v-model="scope.row.quantity"></el-input>
</el-form-item>
</template>
</el-table-column>
</el-table>
</el-form>
data(){
return {
dailogForm:{
gridData:[]
},
daiRules:{
quantity: [{ required: true, message: ' Please fill in the quantities ', trigger: 'blur' }],
}
}
}
Tree table control expands the specified level
// Recursive modification
function recursionExpand(data, status, level) {
data.forEach((item) => {
tableRef.value.toggleRowExpansion(item, status)
if (item.children) {
// Switch all
if (level === 0) {
recursionExpand(item.children, status, level)
} else {
// Other grades ; Like driving 2 level
if (item.levelGroup < level) {
recursionExpand(item.children, status, level)
} else {
// Greater than the current level
recursionExpand(item.children, !status, level)
}
}
}
})
}
// Use
After the table is rendered , call ,level Control the level of deployment ,0 Then everything unfolds ,status by true an
recursionExpand(state.tableData, true, 0)elementui Table custom totals , And put the and lines to the front
add to :summary-method="getSummaries" show-summary
<el-table ref="tableRef" :data="tableData" :summary-method="getSummaries" show-summary
row-key="subCode"
border
>
</el-table>
//sums Each item of the returned array , Is the column corresponding to the total item
const getSummaries = (param) => {
const { columns, data } = param
//columns Is the data of each column , There are field names
//data Table data
console.log('columns', columns)
console.log('data', data)
const sums = []
columns.forEach((column, index) => {
let temparr = [0, 6, 7, 8, 9]
if (temparr.includes(index)) {
sums[index] = '-'
return
}
const values = data.map((item) => Number(item[column.property]))
if (!values.every((value) => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
if (index === 5) {
sums[index] += '%'
}
} else {
sums[index] = 'N/A'
}
})
return sums
}
css Control the total at the top :
/deep/ .el-table {
display: flex;
flex-direction: column;
}
// order The default value is 0, Just put the table body order Set as 1 You can move to the last , In this way, the total line will move up to the top of the table body
/deep/ .el-table__body-wrapper {
order: 1;
}
el-input Input box add unit
<el-input v-model="item.pjcd" :disabled="isdisabled">
<template #suffix>
<span class="suffixtype"> element </span>
</template>
</el-input>边栏推荐
- JS foundation -- math
- [stm32f103rct6] motor PWM drive module idea and code
- Automatic backup of Linux server PostgreSQL database
- Download the jar package of jsqlparser and PageHelper
- Resolve the error: org.apache.ibatis.binding.bindingexception
- Backtracking to solve combinatorial problems
- Dynamic programming -- Digital DP
- # CF #808 Div.2(A - C)
- Review all frames before sum of SSM frames
- JS construction linked list
猜你喜欢

Vulntarget vulnerability shooting range -vulntarget-b

JS written test -- regular expression

Experiment 4 CTF practice

Tp5.1 initialize initialization method (not \u initialize)

Conceptual distinction between Po, Bo, VO, dto and POJO

Learning record Xi

Resolve the error: org.apache.ibatis.binding.bindingexception

Rotating frame target detection mmrotate v0.3.1 training hrsc2016 data set (II)

SQL Server 2022 installation

Method of adding kernel in Jupiter notebook
随机推荐
Edit mathematical formulas in markdown
Unity refers to a variable in another class (its own instance)
Vulntarget vulnerability shooting range -vulntarget-b
Clothing ERP | ten advantages of clothing ERP for enterprises
Riotboard development board series notes (V) -- porting u-boot
Inheritance (prototype)
Hashcode details
Method of adding kernel in Jupiter notebook
Daily three questions 7.19
Decoding webp static pictures using libwebp
Use pytest + allure to show the chart results (3)
6.0 cancellation of member registration verification code
"Introduction to interface testing" punch in day06: interface testing platform: are tools and frameworks incompatible?
List title of force buckle summary
JS foundation -- regular expression
Error: tomee required to support ear/ejb deployment
JS written test question -- prototype, new, this comprehensive question
Simulation Implementation of string function (Part 1)
Permanently mount the image steps
Class notes (4) (2) -- 572. Compete