In Laravel spark, a <div/>
enclosing a rendered form element might look like this
<div class="form-group" :class="{'has-error': form.errors.has('name')}">
</div>
That is -- is has a :class
attribute. What is this? I get the intent/behavior -- if the form.errors.hash('name')
call returns true (with form
being a SparkForm
set on the enclosing component) then the div will have an has-error
class. However, what makes :class
work? My first assumption was it's a Vue.js thing, but if I read the Vue docs on class and style bindings, it (seems like?) Vue.js expects an attribute named v-bind:class
<div class="form-group" v-bind:class="{'has-error': form.errors.has('name')}">
</div>
So what makes :class
work? Is this a Vue.js provided short cut? (if so, is it documented somewhere?).
Is this some patented Laravel syntactic sugar to make writing templates a bit less verbose? If so, where's this implemented?
Is it some third thing?