Compare commits

...

7 Commits

Author SHA1 Message Date
youxingzhi
d1e12aad85 1.4.5 2020-05-30 22:13:14 +08:00
youxingzhi
d5dd9b88c9 fix: 🐛 #72 2020-05-30 22:12:00 +08:00
youxingzhi
ccb1067713 1.4.4 2020-04-25 19:44:54 +08:00
ayou
d5705f92e8 Merge pull request #68 from laashub/master
update: after blur emit the event for changeName
2020-04-10 11:48:34 +08:00
tristan-tsl
ae494ce25f update: after blur emit the event for changeName 2020-04-06 13:11:15 +08:00
tristan-tsl
c59015fdf7 update: after blur emit the event for changeName 2020-04-06 13:05:32 +08:00
ayou
5f94ebf51b Merge pull request #65 from ParadeTo/feature-code-format
chore: 🤖 add code format tool
2020-01-30 13:36:42 +08:00
4 changed files with 25 additions and 10 deletions

View File

@@ -31,7 +31,12 @@
</template>
<template v-slot:treeNodeIcon="slotProps">
<span class="icon">
{{ (slotProps.model.children && slotProps.model.children.length > 0 && !slotProps.expanded) ? '🌲' : '' }}</span>
{{
slotProps.model.children && slotProps.model.children.length > 0 && !slotProps.expanded
? '🌲'
: ''
}}</span
>
</template>
</vue-tree-list>
<button @click="getNewTree">Get new tree</button>
@@ -42,7 +47,7 @@
</div>
</template>
<script>
import {VueTreeList, Tree, TreeNode} from '../src'
import { VueTreeList, Tree, TreeNode } from '../src'
export default {
components: {
VueTreeList
@@ -105,23 +110,23 @@ export default {
console.log(params)
},
drop: function({node, src, target}) {
drop: function({ node, src, target }) {
// eslint-disable-next-line no-console
console.log('drop', node, src, target)
},
dropBefore: function({node, src, target}) {
dropBefore: function({ node, src, target }) {
// eslint-disable-next-line no-console
console.log('drop-before', node, src, target)
},
dropAfter: function({node, src, target}) {
dropAfter: function({ node, src, target }) {
// eslint-disable-next-line no-console
console.log('drop-after', node, src, target)
},
addNode() {
var node = new TreeNode({name: 'new node', isLeaf: false})
var node = new TreeNode({ name: 'new node', isLeaf: false })
if (!this.data.children) this.data.children = []
this.data.addChildren(node)
},

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "vue-tree-list",
"version": "1.4.3",
"version": "1.4.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "vue-tree-list",
"version": "1.4.3",
"version": "1.4.5",
"description": "A vue component for tree structure. Support adding treenode/leafnode, editing node's name and dragging.",
"author": "ayou",
"scripts": {

View File

@@ -221,7 +221,8 @@ export default {
this.rootNode.$emit('change-name', {
id: this.model.id,
oldName: oldName,
newName: e.target.value
newName: e.target.value,
node: this.model
})
},
@@ -238,8 +239,16 @@ export default {
})
},
setUnEditable() {
setUnEditable(e) {
this.editable = false
var oldName = this.model.name
this.model.changeName(e.target.value)
this.rootNode.$emit('change-name', {
id: this.model.id,
oldName: oldName,
newName: e.target.value,
eventType: 'blur'
})
},
toggle() {
@@ -287,6 +296,7 @@ export default {
return true
},
dragEnter() {
if (!compInOperation) return
if (compInOperation.model.id === this.model.id || !compInOperation || this.model.isLeaf)
return
this.isDragEnterNode = true