This time I will bring you the method of operating iview with element-ui control. What are the precautions for operating iview with element-ui control? The following is a practical case, let’s take a look.
Implementation principle
Modified the element-ui source code, extracted the tree module in the source codeThen modified the checkbox and other components that come with element as Checkbox of iview, and compatible methodFinally modified the element style, changed it to iview style, and added some styles myselfThe new tree component can be said to be the logic of element and 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); },
How to use
Must install iviewAll styles are replaced with ivewThe functions are all in accordance with element- The ui is the same as beforenpm i chu-tree-iview
import chuView from 'chu-tree-iview' Vue.use(chuView) <chu-tree></chu-tree>
Detailed explanation of the use case of the created method
Detailed explanation of the use case of the router attribute of Angular4
The above is the detailed content of How element-ui control operates iview. For more information, please follow other related articles on the PHP Chinese website!