javascript - Vuejs display a value within an object returned by a method -
i want display 'name' value only, within object returned method.
what displayed is: [ { "city": "ottawa", "name": "senators", "province": "ontario", ".key": "-kp00xaret2edfrzvmks" } ]
i want displayed "senators".
here's snippets of code:
... in template <td>{{props.item.away}} {{ teamdetail(props.item.away) }}</td> ... in script methods: { teamdetail(inpt) { return this.teams.filter((team) => { return team['.key'] == inpt; }) }, props.item.away .key sent teamdetail retrieve object specific team, object returned in case [ { "city": "ottawa", "name": "senators", "province": "ontario", ".key": "-kp00xaret2edfrzvmks" } ]
to display 'name' only, tried within template {{ teamdetail(props.item.away).name }} , within filter in method
i tried computed can't access key 'this.props.item.away'
computed: { teamdtl() { return this.teams.filter((team) => { return team['.key'] == this.props.item.away; }) },
Comments
Post a Comment