This time I will bring you a detailed explanation of the steps for modifying iview with vue.js element-ui tree control. What are the precautions for modifying iview with vue.js element-ui tree control? Here is the actual combat Let’s take a look at the case.
The tree tree control of element-ui component modified the source code to iview componentImplementation principle
Modified the element-ui source code and changed the source code Extract the tree module insideThen modify the element's own checkbox and other components to iview's checkbox, and the compatible methodFinally modify the element style to iview style, and also add some styles myself The new tree component can be said to be the logic of element, the style of iview<template> <p @click.stop="handleClick" v-show="node.visible"> <p class="chu-tree-nodecontent" :style="{ 'padding-left': (node.level - 1) * tree.indent + 'px' }"> <span :class="arrowClasses" @click.stop="handleExpandIconClick"> <Icon v-if="!node.isLeaf" type="arrow-right-b"></Icon> </span> <Checkbox v-if="showCheckbox" :value="node.checked" :indeterminate="node.indeterminate" :disabled="!!node.disabled" @click.native.stop @on-change="handleCheckChange"></Checkbox> <span v-if="node.loading" class="ivu-load-loop"> </span> <node-content :node="node"></node-content> </p> <collapse-transition> <p v-show="expanded"> <el-tree-node :render-content="renderContent" v-for="child in node.childNodes" :key="getNodeKey(child)" :node="child" @node-expand="handleChildNodeExpand"> </el-tree-node> </p> </collapse-transition> </p> </template>
handleCheckChange(ev) { this.node.setChecked(ev, !this.tree.checkStrictly); },
Usage method
iview must be installedStyles have all been replaced with ivewThe functions are all the same as element-ui
npm i chu-tree-iview
import chuView from 'chu-tree-iview' Vue.use(chuView) <chu-tree></chu-tree>
Yuansheng JS implements file drag and drop events
Detailed explanation of the use of vue global local components
The above is the detailed content of Detailed explanation of steps to modify iview with vue.js+element-ui tree control. For more information, please follow other related articles on the PHP Chinese website!