接收后端传过来的值:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| var opTypes = new Vue({ el: '#select_type_area', data: { types: JSON.parse([[${contentTypes}]]), activeType: '' }, methods: { selected: function(type) { this.activeType = type } } });
|
Thymeleaf 不支持 Vue 简写语法, 因为他默认使用的HTML严格检查, 下面的缩写都会报错:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <div id="app-11"> <a v-bind:href="url">...</a>
<a :href="url">...</a>
<a v-on:click="doSomething">...</a>
<a @click="doSomething">...</a> </div>
|
取消严格检查:
1 2 3 4 5 6
| <!-- thymeleaf模板对html5标签不使严格检查 --> <dependency> <groupId>net.sourceforge.nekohtml</groupId> <artifactId>nekohtml</artifactId> <version>1.9.22</version> </dependency>
|
添加配置:
1 2 3 4
| #默认严格检查 #spring.thymeleaf.mode=HTML5 #非严格检查 spring.thymeleaf.mode=LEGACYHTML5
|
Vue v-for 使用时必须符合语义,
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <table class="table01" id="tableList"> <tr v-for="todo in todos">{{ todo.contentName }}</tr> </table>
<table class="table01" id="tableList"> <tr v-for="todo in todos"><td>{{ todo.contentName }}</td></tr> </table>
<table class="table01" id="tableList"> <tbody is="button-counter" v-for="item in todos" v-bind:todo="item" v-on:increment="incrementTotal"></tbody> </table>
|