0

I'm working on PageKit CMS (https://github.com/pagekit/pagekit) at the moment. Pagekit works with vue.js...

There is something I do not get at the moment.

I try to add values in my controller like this:

$test = 'MyTestString';
return [
    '$view' => [
        'title' => $id ? __( 'Edit Team' ) : __( 'Add Team' ),
        'name'  => 'asc:views/admin/team-edit.php'
    ],
    '$data' => [
        'statuses' => Team::getStatuses(),
    ],
    'team' => $test
];

You see? testis outside the $data-field. Now I would like to add this to my view:

data: function () {
    return {
        data: window.$data,
        team: window.$data.team,
        sections: []
    }
},

sounds strange?

Well, I took the example from https://github.com/pagekit/extension-blog/blob/master/app/views/admin/post-edit.js#L8 .

Now if I try to output {{ team | json }} in my view it's empty :-(

BUT: Echoing out <?= $team; ?> in the view works. So why can't I output {{team | json }}?

andreas
  • 16,357
  • 12
  • 72
  • 76
MyFault
  • 427
  • 1
  • 6
  • 21
  • Try using a computed property instead for team. It also looks like team is not inside $data but statuses is – vbranden Jul 26 '16 at 13:46
  • Hi @vbranden - I do not know what you mean with `computed property`. Do you have an example for this? – MyFault Jul 27 '16 at 09:16

0 Answers0