0

I have an app that has components nested inside. The app is called on the filter id. I have a data element named minTotalSpent. Currently, this contains "3" in the app. The first placement on the page displays appropriately. When I try to pass it in as a variable into vue-slider, however, it does not like it and throws an "invalid expression"warning on the counsel and does not respect the minimum.

<div id="filter">
  <form id="search">
    Search <input name="query" v-model="searchQuery">
  </form>
  {{minTotalSpent}}
  <div class="filter-container-slider">
    <vue-slider
    :min="{{minTotalSpent}}"
    :max="42"
    :value="2"

    >
2
  • 4
    just :min="minTotalSpent" Commented Apr 27, 2017 at 15:08
  • like @thanksd said. because as soon as you use the :, Vue knows that what's in the quotes is an expression, so you don't use the double curly braces. Commented Apr 27, 2017 at 15:16

1 Answer 1

1

Just elaborating as per @thanksd's answer.

When using any component, over here vue-slider component, if you use v-min = "..." or :min = "...", the value of v-min or :min is in a javascript expression and you cannot use mustaches inside javascript expression.

And when it comes to html attributes like id on any element, you should be using v-bind.

<div v-bind:id="dynamicId"></div>

Read more about them here: https://v2.vuejs.org/v2/guide/syntax.html#Attributes

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.