{"action":"created","issue":{"url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1048","labels_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1048/labels{/name}","comments_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1048/comments","events_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1048/events","html_url":"https://github.com/RubyLouvre/avalon/issues/1048","id":106512304,"number":1048,"title":"OniUI 的tree组件，遇到点问题~","user":{"login":"z893495246","id":14210139,"avatar_url":"https://avatars.githubusercontent.com/u/14210139?v=3","gravatar_id":"","url":"https://api.github.com/users/z893495246","html_url":"https://github.com/z893495246","followers_url":"https://api.github.com/users/z893495246/followers","following_url":"https://api.github.com/users/z893495246/following{/other_user}","gists_url":"https://api.github.com/users/z893495246/gists{/gist_id}","starred_url":"https://api.github.com/users/z893495246/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/z893495246/subscriptions","organizations_url":"https://api.github.com/users/z893495246/orgs","repos_url":"https://api.github.com/users/z893495246/repos","events_url":"https://api.github.com/users/z893495246/events{/privacy}","received_events_url":"https://api.github.com/users/z893495246/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-15T08:54:53Z","updated_at":"2015-09-15T09:21:32Z","closed_at":null,"body":"我在做一个OA系统，需要展示上下级关系，用到tree这个控件。\r\n我这边数据绑定不成功，但是也不报错，我的json数据：\r\n{dept_id: 2，dept_name: \"上海总部\"，dept_no: 1}\r\n{dept_id:5,dept_name:\"渠道部\"，dept_no:2}\r\n{XX}\r\n{XX}\r\n-------------------------------------------------------------\r\n当我用它自己的json数据的时候，是可以完美的展示的。它 的json：\r\nzNodes =[\r\n            { id:1, pid:0, name:\"父节点1 - 展开\", open:true},\r\n            { id:11, pid:1, name:\"父节点11 - 折叠\"},\r\n            { id:111, pid:11, name:\"叶子节点111\"},\r\n            { id:112, pid:11, name:\"叶子节点112\"},\r\n            { id:113, pid:11, name:\"叶子节点113\"},\r\n            { id:114, pid:11, name:\"叶子节点114\"},\r\n            { id:12, pid:1, name:\"父节点12 - 折叠\"},\r\n            { id:121, pid:12, name:\"叶子节点121\"},\r\n            { id:122, pid:12, name:\"叶子节点122\"},\r\n            { id:123, pid:12, name:\"叶子节点123\"},\r\n            { id:124, pid:12, name:\"叶子节点124\"},\r\n            { id:13, pid:1, name:\"父节点13 - 没有子节点\", isParent:true},\r\n            { id:2, pid:0, name:\"父节点2 - 折叠\"},\r\n            { id:21, pid:2, name:\"父节点21 - 展开\", open:true},\r\n            { id:211, pid:21, name:\"叶子节点211\"},\r\n            { id:212, pid:21, name:\"叶子节点212\"},\r\n            { id:213, pid:21, name:\"叶子节点213\"},\r\n            { id:214, pid:21, name:\"叶子节点214\"},\r\n            { id:22, pid:2, name:\"父节点22 - 折叠\"},\r\n            { id:221, pid:22, name:\"叶子节点221\"},\r\n            { id:222, pid:22, name:\"叶子节点222\"},\r\n            { id:223, pid:22, name:\"叶子节点223\"},\r\n            { id:224, pid:22, name:\"叶子节点224\"},\r\n            { id:23, pid:2, name:\"父节点23 - 折叠\"},\r\n            { id:231, pid:23, name:\"叶子节点231\"},\r\n            { id:232, pid:23, name:\"叶子节点232\"},\r\n            { id:233, pid:23, name:\"叶子节点233\"},\r\n            { id:234, pid:23, name:\"叶子节点234\"},\r\n            { id:3, pid:0, name:\"父节点3 - 没有子节点\", isParent:true}\r\n        ]\r\ntree的配置：\r\nvm.tree = {\r\n                children: vm.zNodes,\r\n                edit: {\r\n                    showRemoveBtn: function(leaf) {\r\n                        return leaf.level > 0\r\n                    }\r\n                },\r\n                data: {\r\n                    simpleData: {\r\n                        enable: true,\r\n                        idKey: \"dept_id\",\r\n                        pIdKey: \"dept_no\"\r\n                    },\r\n                    key: {\r\n                        name: \"dept_name\", \r\n                    },\r\n\r\n                    keep: {\r\n                        leaf: false,\r\n                        parent: true\r\n                    }\r\n                },\r\n                view: {\r\n                    editNameSelectAll: true,\r\n                    showLine: function(leaf) {\r\n                        return true\r\n                        return leaf.level > 1 || 1\r\n                    }\r\n                },\r\n                callback: {\r\n                    onExpand: function(leaf) {\r\n                        console.log(leaf)\r\n                    },\r\n                    beforeRemove: function(obj) {\r\n                        return confirm(\"确认删除?\")\r\n                    },\r\n                    onRemove: function(leaf) {\r\n                        console.log(\"remove \" + leaf)\r\n                    },\r\n                    onRename: function(arg) {\r\n                        console.log(\"renamed\")\r\n                    },\r\n                    beforeAdd: function(obj) {\r\n                        return confirm(\"确认添加?\")\r\n                    },\r\n                    onNodeCreated: function(obj) {\r\n                        avalon.log(\"node onNodeCreated\")\r\n                    }\r\n                }\r\n            }\r\n            vm.$treeOpt = {\r\n                children: [vm.child[0]]\r\n            }\r\n            vm.$skipArray = [\"tree\"]\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/RubyLouvre/avalon/issues/comments/140334721","html_url":"https://github.com/RubyLouvre/avalon/issues/1048#issuecomment-140334721","issue_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1048","id":140334721,"user":{"login":"z893495246","id":14210139,"avatar_url":"https://avatars.githubusercontent.com/u/14210139?v=3","gravatar_id":"","url":"https://api.github.com/users/z893495246","html_url":"https://github.com/z893495246","followers_url":"https://api.github.com/users/z893495246/followers","following_url":"https://api.github.com/users/z893495246/following{/other_user}","gists_url":"https://api.github.com/users/z893495246/gists{/gist_id}","starred_url":"https://api.github.com/users/z893495246/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/z893495246/subscriptions","organizations_url":"https://api.github.com/users/z893495246/orgs","repos_url":"https://api.github.com/users/z893495246/repos","events_url":"https://api.github.com/users/z893495246/events{/privacy}","received_events_url":"https://api.github.com/users/z893495246/received_events","type":"User","site_admin":false},"created_at":"2015-09-15T09:21:32Z","updated_at":"2015-09-15T09:21:32Z","body":"我觉得应该是我赋值有问题，赋值之后输出\r\n----------------------------------------------------------\r\nSon: [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, $id: \"avalon331029944122\", $model: Array[20], $events: Object, _: Object, $watch: function…]0: Object$events: Object$fire: function () { [native code] }$id: \"avalon557760477066\"$model: Objectdept_id: 2dept_name: \"上海总部\"dept_no: 1__proto__: Object$reinitialize: function () {$unwatch: function () { [native code] }$watch: function () { [native code] }dept_id: (...)get dept_id: function accessor(value) {set dept_id: function accessor(value) {dept_name: (...)get dept_name: function accessor(value) {set dept_name: function accessor(value) {dept_no: (...)get dept_no: function accessor(value) {set dept_no: function accessor(value) {hasOwnProperty: function (name) {__proto__: Object1: Object2: Object3: Object4: Object5: Object6: Object7: Object8: Object9: Object10: Object11: Object12: Object13: Object14: Object15: Object16: Object17: Object18: Object19: Object$events: Object$fire: function (type) {$id: \"avalon331029944122\"$model: Array[20]$unwatch: function (type, callback) {$watch: function (type, callback) {_: Object_fire: function (method, a, b) {_splice: function splice() { [native code] }clear: function () {contains: function (el) { //判定是否包含ensure: function (el) {length: 20pop: function () {push: function () {pushArray: function (array) {remove: function (el) { //移除第一个等于给定值的元素removeAll: function (all) { //移除N个元素removeAt: function (index) { //移除指定索引上的元素reverse: function () {set: function (index, val) {shift: function () {size: function () { //取得数组长度，这个函数可以同步视图，length不能sort: function () {splice: function (start) {unshift: function () {__proto__: Array[0]"}}