the scroll bar style of the default element-ui table is like this, is there any other scroll bar style? How to modify it?
the scroll bar style of the default element-ui table is like this, is there any other scroll bar style? How to modify it?
the scroll bar style has been modified before when using the element-ui table, but there is no official way to change it
later, please refer to
//
.your-table .el-table__body-wrapper::-webkit-scrollbar {
width: 10px;
height: 10px;
}
//
.your-table .el-table__body-wrapper::-webkit-scrollbar-thumb {
background-color: -sharpa1a3a9;
border-radius: 3px;
}
if the scroll bar style of the whole page is consistent, directly changing the global scroll bar style can also be effective
//
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
//
::-webkit-scrollbar-thumb {
background-color: -sharpa1a3a9;
border-radius: 3px;
}
there is a compatibility problem with scroll bar styles. The above styles are available in webkit browsers
casually find a scroll bar plug-in and then use the custom command
to complete
I selected perfect-scrollbar (for details on how this plug-in, which is not made for vue, can be used in vue, please see " an article I wrote )
is roughly as follows
import Vue from 'vue';
//
import PerfectScrollbar from 'perfect-scrollbar';
//css
import "perfect-scrollbar/css/perfect-scrollbar.css";
/**
* @description PerfectScrollbar
* @param {Element} el - dom
*/
const el_scrollBar = (el) => {
//_ps_
if (el._ps_ instanceof PerfectScrollbar) {
el._ps_.update();
} else {
//el
el._ps_ = new PerfectScrollbar(el, { suppressScrollX: true });
}
};
Vue.directive("anyNameYouLike",{
inserted(el, binding){
const { arg } = binding;
if(arg === ""){
el = el.querySelector(".el-table__body-wrapper");
if(!el){
return console.warn("classNameel-table__body-wrapperdom");
}
}
const rules = ["fixed", "absolute", "relative"];
if (!rules.includes(window.getComputedStyle(el, null).position)) {
console.error(`perfect-scrollbarposition:${rules.join("")}`)
}
el_scrollBar(el);
},
componentUpdated(el, binding, vnode) {
const { arg } = binding;
if (arg === "") {
el = el.querySelector(".el-table__body-wrapper");
if(!el){
return console.warn("classNameel-table__body-wrapperdom");
}
}
vnode.context.$nextTick(
() => {
try {
el_scrollBar(el);
} catch (error) {
console.error(error);
}
}
)
},
})
then it's easy for you to use
if it's a normal element
<div v-anyNameYouLike>
<!---->
</div>
if it is the table component of ele.me
<el-table :data="" v-anyNameYouLike:>
<!---->
</el-table>
is it very simple
effect to stand out
I guess what you mean is that you want to keep the table header from scrolling, just scroll table-body.
you can deal with it like this:
for example, @ A Snake responder's solution adds a condition.
const el_scrollBar = (el) => {
// `.el-table__body-wrapper`Elementui
const dom = el.querySelector('.el-table__body-wrapper')
if (dom._ps_ instanceof PerfectScrollbar) {
dom._ps_.update();
} else {
dom._ps_ = new PerfectScrollbar(dom, { suppressScrollX: true });
}
};
Previous: Is there any way to convert word documents generated by Freemaker into standard word documents?
there is a requirement that when Select selects a city, it needs fuzzy search, which supports not only Chinese, but also pinyin, acronyms and so on. The back end will give me the corresponding fields, but I find that using filter-method to pass in funct...
Error in event handler for "row-contextmenu": "TypeError: $event.preventDefault is not a function" Please tell me how to add .client to row-contextmenu . ...
how can select empty the selected data and display the original placeholder?? here is my code: ...
tries to use ref, which returns a real example of a component, and then I don t know what to do with how to get the width of header. ...
there is a requirement for the product to put the filter criteria of table here in the table header, and the content is more customized; elementUi1.filters,2.elementUipopover()table dare to ask everyone how to solve the problem, do you want to bui...
look for it on the official website, but there is no corresponding example and api <template> <el-select class="g-public-multi-select" v-model="selectWeekDayListProp" :disabled="disabled" @change="selectCha...
the current project uses vue and element to do, and finds a problem. After entering the current page, it will request an interface with 3000 + pieces of interface data, and then send the data to element-ui to render the select, (page rendering will not ...
I use element ui but don t know how to merge the last column. ...
when checked, I want to pass the row data item, and insert the uid in the item into the array selectedId according to the value of the value after the CheckBox update. there is only one default callback parameter in the official document. I want to pas...
the hair hair doctor, the Master Satan, flew over the place on time ...
before triggering the search event, everything is normal after the drop-down selection, click the search button, other drop-down box selectors can not be selected normally, can trigger the change event, but it is not displayed on the page, click on mor...
the default click is blue. I want to change the color, but there is no effect after adding it in from. How can I change it? <el-form-item label="" prop="resource" fill="red"> <el-radio-group v-mod...
: auto-upload= "false " after it is added, it will not be uploaded automatically. How can I upload it manually when I submit it? ...
problem description after the header is dragged, the data changes, but the sorting method remains the same? the environmental background of the problems and what methods you have tried in the element-ui table header drag effect, view the data, and...
the sortchange hook function is called when sorting, and then the initsort method is triggered. I wanted to keep the first row from moving up (forcing the sorted image to be updated without success), but the table data changed, but the page did not chan...
Is there a complete example of ? Official documents can only be added and deleted, but there is no editing function. How to edit this officially, only can be added or deleted. ...
when the elementUI tab page is switched, the corresponding tab-pane component I use the dynamic component, and then I find that it only triggers the mounted event, and there is no event trigger when I leave. before-leave, with tab tag finds that oldAct...
as shown in the figure, the simplest type, how to add background color to the header, write a lot of css are invalid ah, why? <el-table border :data="tableData" style="width: 100%"> <el-table-column prop="...
is using elementUI as the background. Use the component for uploading pictures. Click the plus sign to add the picture normally. But when the form needs to be re-edited, you need to show these pictures first, and the question is how to do it. ...
I want to set the maximum width for this column so that it can change with the number of pictures, not in space. Is there any way to set the maximum width of the column, or to achieve the effect I want. Ask the bosses for guidance, Orz thank you very...