Friday, January 17, 2020

Using Vue Variable in Jinja Python Flask


- Using {% raw %} directive
ex.

<div id="app">
{% raw %}
{{ var_from_vue }}
{% endraw %}
</div>

- Using Vue delemiters in Vue Instant
ex.

var app = new Vue({
    el: '#app',
    data: {
        v1: 'variable 1'
    },
    delimiters: ['[[', ']]'] 
})

- Custom Directive in Python Flask Jinja
ex.

app = Flask(__name__)

jinja_options = app.jinja_options.copy()
jinja.options.update(dict(
    variable_start_string='[[',
    variable_end_string=']]'
))
app.jinja_options = jinja_options

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

ALCATEL 6900

write memory copy running certified reload from working no rollback-timeout