[Vuejs]-How to render flask jinja2 objects in a vuejs v-for draggable list?

0👍

First of all rendering data in a component like that is a bad practice in general. The best option would be to get the data from an api for better decoupling, but you if you really have to render the data in your template you should rather render it inside a custom property than inside the component, like you are doing it with :option.

Now to the actual problem. You are trying to render a python dictionary to a string into a a place where a json format is expected, that’s obviously not gonna work. You’ll have to convert it to json first, you can use the json module for that.

Example taken from the documentation would look like this:

import json
json.dumps({"c": 0, "b": 0, "a": 0})

Keep in mind that the logical structure of your dictionary has to be the same as your expected json, not just optically.

Leave a comment