{"action":"created","issue":{"url":"https://api.github.com/repos/davestewart/vuex-pathify/issues/19","repository_url":"https://api.github.com/repos/davestewart/vuex-pathify","labels_url":"https://api.github.com/repos/davestewart/vuex-pathify/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/davestewart/vuex-pathify/issues/19/comments","events_url":"https://api.github.com/repos/davestewart/vuex-pathify/issues/19/events","html_url":"https://github.com/davestewart/vuex-pathify/issues/19","id":334226965,"node_id":"MDU6SXNzdWUzMzQyMjY5NjU=","number":19,"title":"Handling arrays properly","user":{"login":"haexhub","id":29780781,"node_id":"MDQ6VXNlcjI5NzgwNzgx","avatar_url":"https://avatars0.githubusercontent.com/u/29780781?v=4","gravatar_id":"","url":"https://api.github.com/users/haexhub","html_url":"https://github.com/haexhub","followers_url":"https://api.github.com/users/haexhub/followers","following_url":"https://api.github.com/users/haexhub/following{/other_user}","gists_url":"https://api.github.com/users/haexhub/gists{/gist_id}","starred_url":"https://api.github.com/users/haexhub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haexhub/subscriptions","organizations_url":"https://api.github.com/users/haexhub/orgs","repos_url":"https://api.github.com/users/haexhub/repos","events_url":"https://api.github.com/users/haexhub/events{/privacy}","received_events_url":"https://api.github.com/users/haexhub/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-06-20T19:56:44Z","updated_at":"2018-06-21T11:41:18Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI've got one more question about handling arrays. I read your documentation about this, but was not able to get it to work. Could you please give me some advise? \r\n\r\n_store/index.js_\r\n\r\n```\r\nexport const state = () => {\r\n  foo: {\r\n    bar: [\r\n      { foobar: 'hello' }\r\n    , { foobar: 'world' }\r\n    ]\r\n  }\r\n}\r\n```\r\n\r\n_pages/index.js_\r\n```\r\n<template>\r\n  <div>\r\n    <input v-for = 'item in items' v-model = 'item.foobar'/>\r\n  </div>\r\n</template>\r\n\r\n<script>\r\n  computed: {\r\n    items: sync('foo@bar') // values come up, but can't mutate them\r\n  // ...sync('foo@bar.*') // not working\r\n  // items: sync('foo', ['bar']) not working but written in your docs\r\n  }\r\n</script>\r\n```\r\n\r\nYou could probably make your documentation more precisly? :smile: "},"comment":{"url":"https://api.github.com/repos/davestewart/vuex-pathify/issues/comments/399074432","html_url":"https://github.com/davestewart/vuex-pathify/issues/19#issuecomment-399074432","issue_url":"https://api.github.com/repos/davestewart/vuex-pathify/issues/19","id":399074432,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTA3NDQzMg==","user":{"login":"haexhub","id":29780781,"node_id":"MDQ6VXNlcjI5NzgwNzgx","avatar_url":"https://avatars0.githubusercontent.com/u/29780781?v=4","gravatar_id":"","url":"https://api.github.com/users/haexhub","html_url":"https://github.com/haexhub","followers_url":"https://api.github.com/users/haexhub/followers","following_url":"https://api.github.com/users/haexhub/following{/other_user}","gists_url":"https://api.github.com/users/haexhub/gists{/gist_id}","starred_url":"https://api.github.com/users/haexhub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haexhub/subscriptions","organizations_url":"https://api.github.com/users/haexhub/orgs","repos_url":"https://api.github.com/users/haexhub/repos","events_url":"https://api.github.com/users/haexhub/events{/privacy}","received_events_url":"https://api.github.com/users/haexhub/received_events","type":"User","site_admin":false},"created_at":"2018-06-21T11:41:18Z","updated_at":"2018-06-21T11:41:18Z","author_association":"NONE","body":"Thank you @davestewart :smile: \r\nYou were right. I had to create my own update function and it looks like this:\r\n_store/index.js_\r\n```\r\n\r\nexport const state = () => {\r\n  templates: {\r\n    offer: {\r\n      foo: { value: 'Hello' }\r\n    , bar: { value: 'World' }\r\n} } }\r\n\r\nexport const mutations = {\r\n  ...make.mutations(this.state)\r\n, update_foo (state, { index, value }) {\r\n    if (state.hasOwnProperty(templates.offer[index].value))\r\n      state.templates.offer[index].value = value\r\n  }\r\n}\r\n```\r\n\r\n_pages/index.vue_\r\n```\r\n<template>\r\n  <input v-for = '(item, index) in items' :value = 'item.value' @input = 'update(index, $event)'/>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n  props: {\r\n    path: {\r\n      type: String\r\n    }\r\n  }\r\n, computed: {\r\n    items: sync('templates@offer') // works, but I want to use the prop path!\r\n  // items () { return sync(this.path) } // results in: items: { get () {}, set () {} }\r\n  }\r\n, methods: {\r\n    update (index, value) {\r\n      this.$store.commit('update_foo', { index, value } )\r\n    }\r\n  }\r\n}\r\n</script>\r\n```\r\n\r\nThe Vue docs says, that you need to use a function inside computed properties, if you want to access _ _this_."}}
{"actor":{"display_login":"haexhub"}}