Use v-bind
or the :
shorthand to pass in non-string values like this:
<!-- language: lang-html -->
<pre><code><v-toolbar
<b><a href="https://v1.vuejs.org/guide/syntax.html#v-bind-Shorthand">:</a></b>scroll-threshold="777">
</v-toolbar></code></pre>
If you pass in a static value for the attribute like this:
<!-- language: lang-html -->
<pre><code><v-toolbar
color="pink"
class="toolbar"
flat
<b>scroll-threshold="777"</b>>
</v-toolbar></code></pre>
It is always parsed as just a string and will compile into something like this:
<pre><code>_c("v-toolbar", {
staticClass: "toolbar",
attrs: {
color: "pink",
flat: "",
<b>"scroll-threshold": "777"</b>
}
}),</code></pre>
Instead, you can use the v-bind
shorthand syntax to pass in a JavaScript expression. Normally, this makes sense when you want to resolve to a property available on the model, but it really just evaluates whatever is inside of outer quotes as regular js.
So if you update to use :scroll-threshold="777"
, the 777
will be evaluated as a number like this:
<pre><code>_c("v-toolbar", {
staticClass: "toolbar",
attrs: {
color: "pink",
flat: "",
<b>"scroll-threshold": 777</b>
}
}),</code></pre>