Skip to content

Commit

Permalink
remove babel plugin,don't use jsx syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
wchbrad committed Aug 18, 2022
1 parent 7f2223e commit 4ab1361
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 68 deletions.
13 changes: 1 addition & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@wchbrad/vue-easy-tree",
"description": "A Vue.js project",
"version": "1.0.8",
"version": "1.0.9",
"author": "wchbrad <[email protected]>",
"license": "MIT",
"private": false,
Expand Down Expand Up @@ -35,17 +35,6 @@
"vue-virtual-scroller": "^1.0.10"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-istanbul": "^4.1.1",
"babel-plugin-module-resolver": "^2.2.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-2": "^6.24.1",
"babel-regenerator-runtime": "^6.5.0",
"core-js": "^3.6.5",
"cross-env": "^3.1.3",
"css-loader": "^2.1.0",
Expand Down
4 changes: 3 additions & 1 deletion src/components/tree-node.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ export default {
) : tree.$scopedSlots.default ? (
tree.$scopedSlots.default({ node, data })
) : (
<span class="el-tree-node__label">{node.label}</span>
h("span", {
class: "el-tree-node__label"
}, node.label)
);
}
}
Expand Down
83 changes: 28 additions & 55 deletions src/components/virtual-tree-node.vue
Original file line number Diff line number Diff line change
@@ -1,59 +1,30 @@
<template>
<div
v-show="node.visible"
ref="node"
class="el-tree-node"
:class="{
'is-expanded': expanded,
'is-current': node.isCurrent,
'is-hidden': !node.visible,
'is-focusable': !node.disabled,
'is-checked': !node.disabled && node.checked
}"
role="treeitem"
tabindex="-1"
:aria-expanded="expanded"
:aria-disabled="node.disabled"
:aria-checked="node.checked"
:draggable="tree.draggable"
@click.stop="handleClick"
@contextmenu="$event => this.handleContextMenu($event)"
@dragstart.stop="handleDragStart"
@dragover.stop="handleDragOver"
@dragend.stop="handleDragEnd"
@drop.stop="handleDrop"
>
<div v-show="node.visible" ref="node" class="el-tree-node" :class="{
'is-expanded': expanded,
'is-current': node.isCurrent,
'is-hidden': !node.visible,
'is-focusable': !node.disabled,
'is-checked': !node.disabled && node.checked
}" role="treeitem" tabindex="-1" :aria-expanded="expanded" :aria-disabled="node.disabled"
:aria-checked="node.checked" :draggable="tree.draggable" @click.stop="handleClick"
@contextmenu="$event => this.handleContextMenu($event)" @dragstart.stop="handleDragStart"
@dragover.stop="handleDragOver" @dragend.stop="handleDragEnd" @drop.stop="handleDrop">
<div class="el-tree-node__content">
<span
aria-hidden="true"
:style="{
'min-width': (node.level - 1) * tree.indent + 'px'
}"
></span>
<span
:class="[
{
'is-leaf': node.isLeaf,
expanded: !node.isLeaf && expanded
},
'el-tree-node__expand-icon',
'el-tree-node__expand-icon-no-transition',
tree.iconClass ? tree.iconClass : 'el-icon-caret-right'
]"
@click.stop="handleExpandIconClick"
></span>
<el-checkbox
v-if="showCheckbox"
v-model="node.checked"
:indeterminate="node.indeterminate"
:disabled="!!node.disabled"
@click.native.stop
@change="handleCheckChange"
></el-checkbox>
<span
v-if="node.loading"
class="el-tree-node__loading-icon el-icon-loading"
></span>
<span aria-hidden="true" :style="{
'min-width': (node.level - 1) * tree.indent + 'px'
}"></span>
<span :class="[
{
'is-leaf': node.isLeaf,
expanded: !node.isLeaf && expanded
},
'el-tree-node__expand-icon',
'el-tree-node__expand-icon-no-transition',
tree.iconClass ? tree.iconClass : 'el-icon-caret-right'
]" @click.stop="handleExpandIconClick"></span>
<el-checkbox v-if="showCheckbox" v-model="node.checked" :indeterminate="node.indeterminate"
:disabled="!!node.disabled" @click.native.stop @change="handleCheckChange"></el-checkbox>
<span v-if="node.loading" class="el-tree-node__loading-icon el-icon-loading"></span>
<node-content :node="node"></node-content>
</div>
</div>
Expand Down Expand Up @@ -91,7 +62,9 @@ export default {
) : tree.$scopedSlots.default ? (
tree.$scopedSlots.default({ node, data })
) : (
<span class="el-tree-node__label">{node.label}</span>
h("span", {
class: "el-tree-node__label"
}, node.label)
);
}
}
Expand Down

0 comments on commit 4ab1361

Please sign in to comment.