vue - Modify ElementUi source code

vue - Modify ElementUi source code

first attempt

Once again, in the project development, some steps in the process of moving bricks to the components of Are you hungry feel very cumbersome, such as some basic attribute configurations of the input box (clearable placeholderetc.) can be modified in the source code

Find the packages under elementui under node_modules, find the input component, go in and modify it,
save and restart the project >> you will find no effect

insert image description here

We find the elementui folder under node_modules and open it to find a lib folder >> This folder is packaged and compiled. Our project also imports lib, so modifying the
components in packages will not take effect

correct modification

insert image description hereinsert image description here





insert image description hereWe
enter its official website, and then enter his git in the update log to clone a copy of the code to your local and start modifying. The part of my example here is to modify the shadow behind the dialog component. npm i initialize the project dependencies and then find the dialog component from the packages, then enter the component.vue under src,
insert image description herewe find the parameter verification item closeonclickmodal under props in the component,
change its default value to false and save it

repackage

After saving, execute the command npm run dist on the outermost layer
to generate a lib folder and replace the
lib folder under elementui under node_modules in your project.

After saving and restarting, use the dialog again to find that clicking the external mask will not automatically close

modified

So far, the source code has been modified. In the actual development, the source code can be modified according to the needs,
which can reduce the amount of bricks and write less cv.

Guess you like

Origin blog.csdn.net/weixin_54645575/article/details/121832560