Array not picked up by Vue

Hey all,

I am trying to send navigation data as an array to my Vue component however the vue component does not receive my data.

Here is my markup:

   <navigation image="{{ theme:img src='logo.png' }}" test="{{ nav_collection }}{{ value }}
{{ /nav_collection }}">
    </navigation>

And in my NavCollectionTags Class I have:

public function index()
    {
        $this->factory = new TreeFactory($this->getParams());

        $tree = $this->factory->create();

        if ($tree->isEmpty()) {
            return null;
        }

        $tree->sort($this->get('sort'));

        // Convert taxonomy fields to actual taxonomy terms.
        // This will allow taxonomy term data to be available in the template without additional tags.
        // If terms are not needed, there's a slight performance benefit in disabling this.
        if ($this->getBool('supplement_taxonomies', true)) {
            $tree->supplementTaxonomies();
        }
            return [json_encode($tree->toArray())];
        }   

The result is that the image is visible in my Vue component but my data tag is an empty string. If I dd([json_encode($tree->toArray())];) then I see an encoded array in my browser.

Any suggestions?

>>>>>>> Unanswered <<<<<<<
3 Replies
3 Followers