{"action":"closed","issue":{"url":"https://api.github.com/repos/vuejs/vuejs.org/issues/518","repository_url":"https://api.github.com/repos/vuejs/vuejs.org","labels_url":"https://api.github.com/repos/vuejs/vuejs.org/issues/518/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vuejs.org/issues/518/comments","events_url":"https://api.github.com/repos/vuejs/vuejs.org/issues/518/events","html_url":"https://github.com/vuejs/vuejs.org/issues/518","id":183842893,"number":518,"title":"Recursive compoment in Tree-view emxaple","user":{"login":"rookiezmh","id":15356890,"avatar_url":"https://avatars.githubusercontent.com/u/15356890?v=3","gravatar_id":"","url":"https://api.github.com/users/rookiezmh","html_url":"https://github.com/rookiezmh","followers_url":"https://api.github.com/users/rookiezmh/followers","following_url":"https://api.github.com/users/rookiezmh/following{/other_user}","gists_url":"https://api.github.com/users/rookiezmh/gists{/gist_id}","starred_url":"https://api.github.com/users/rookiezmh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rookiezmh/subscriptions","organizations_url":"https://api.github.com/users/rookiezmh/orgs","repos_url":"https://api.github.com/users/rookiezmh/repos","events_url":"https://api.github.com/users/rookiezmh/events{/privacy}","received_events_url":"https://api.github.com/users/rookiezmh/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/vuejs/vuejs.org/labels/2.0","name":"2.0","color":"e99695"},{"url":"https://api.github.com/repos/vuejs/vuejs.org/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-19T01:21:25Z","updated_at":"2016-10-25T03:50:03Z","closed_at":"2016-10-25T03:50:03Z","body":"In the guide parts, it says \"Components can recursively invoke themselves in their own template. However, they can only do so with the name option\", however in the tree-view example, the recursive component item doesn't have a name option.Below is the code.\r\n**template**\r\n<script type=\"text/x-template\" id=\"item-template\">\r\n      <li>\r\n        <div\r\n          :class=\"{bold: isFolder}\"\r\n          @click=\"toggle\"\r\n          @dblclick=\"changeType\">\r\n          {{model.name}}\r\n          <span v-if=\"isFolder\">[{{open ? '-' : '+'}}]</span>\r\n        </div>\r\n        <ul v-show=\"open\" v-if=\"isFolder\">\r\n          <item\r\n            class=\"item\"\r\n            v-for=\"model in model.children\"\r\n            :model=\"model\">\r\n          </item>\r\n          <li class=\"add\" @click=\"addChild\">+</li>\r\n        </ul>\r\n      </li>\r\n    </script>\r\n**js**\r\nVue.component('item', {\r\n  template: '#item-template',\r\n  props: {\r\n    model: Object\r\n  },\r\n  data: function () {\r\n    return {\r\n      open: false\r\n    }\r\n  },\r\n  computed: {\r\n    isFolder: function () {\r\n      return this.model.children &&\r\n        this.model.children.length\r\n    }\r\n  },\r\n  methods: {\r\n    toggle: function () {\r\n      if (this.isFolder) {\r\n        this.open = !this.open\r\n      }\r\n    },\r\n    changeType: function () {\r\n      if (!this.isFolder) {\r\n        Vue.set(this.model, 'children', [])\r\n        this.addChild()\r\n        this.open = true\r\n      }\r\n    },\r\n    addChild: function () {\r\n      this.model.children.push({\r\n        name: 'new stuff'\r\n      })\r\n    }\r\n  }\r\n})\r\nDoes it mean it's ok to use a recursive component without a name option or what?"}}
{"actor":{"display_login":"chrisvfritz"}}