Search code examples
vue.jselixirphoenix-frameworkslim-lang

slim template condition syntax with vue.js and elixir


How can I combine a vuejs condition with a vuejs variable and an elixir variable?

<div v-if="vuevar || <%= @conn.assigns.elixirvar %>">

Solution

  • Does that conn.assigns.elixirvar return true or false?

    It's a string actually.

    If it is a string, you should quote it:

    <div v-if="vuevar || '<%= @conn.assigns.elixirvar %>'">
    

    Othwerwise it will be printed as an identifier.