Spring boot 将vuejs 2.0和Thymeleaf与SpringBoot混合使用会产生奇怪的行为
我已经使用Vuejs 2.0编写了一些页面。在静态模式下,我的所有组件都工作,我可以验证设计。 因此,我尝试将这些页面的源代码集成到一个带有Thymeleaf的WebSpring启动项目中,但没有完成一些渲染 具有以下代码的用例:Spring boot 将vuejs 2.0和Thymeleaf与SpringBoot混合使用会产生奇怪的行为,spring-boot,vue.js,thymeleaf,Spring Boot,Vue.js,Thymeleaf,我已经使用Vuejs 2.0编写了一些页面。在静态模式下,我的所有组件都工作,我可以验证设计。 因此,我尝试将这些页面的源代码集成到一个带有Thymeleaf的WebSpring启动项目中,但没有完成一些渲染 具有以下代码的用例: <selectpicker id="selectReg" title="Sélectionnez des régions" data-width="100%" v-bind:multiple="true"
<selectpicker id="selectReg" title="Sélectionnez des régions"
data-width="100%" v-bind:multiple="true"
v-on:selected="selectRegion" v-on:unselected="unselectRegion">
<option value="44">Alsace-Champagne-Ardenne-Lorraine</option>
<option value="75">Aquitaine-Limousin-Poitou-Charentes</option>
<option value="84">Auvergne-Rhône-Alpes</option>
</selectpicker>
阿尔萨斯香槟阿登洛林酒店
阿基坦·利穆森·波图·查伦特斯酒店
阿尔卑斯山奥弗涅
渲染结果为:
<selectpicker id="selectReg" title="Sélectionnez des régions"
data-width="100%" v-bind:multiple="true"
v-on:selected="selectRegion" v-on:unselected="unselectRegion">
Alsace-Champagne-Ardenne-Lorraine
Aquitaine-Limousin-Poitou-Charentes
Auvergne-Rhône-Alpes
</selectpicker>
阿尔萨斯香槟阿登洛林酒店
阿基坦·利穆森·波图·查伦特斯酒店
阿尔卑斯山奥弗涅
这些选项没有保留
另一个问题是v-for属性:
<optgroup label="Île-de-France">
<option v-for="option in departementsFromRegion(11)" v-bind:value="option.value"
v-bind:data-region="option.region">
{{ option.text }}
</option>
</optgroup>
{{option.text}
结果,我在浏览器控制台中遇到一个错误,说该选项未定义
作为参考,我已经将Thymelead配置为LEGACYHTML5
有什么想法吗?我找到了问题的根源。 thymeleaf2.x有一些问题,所以现在我使用3.0版 为此,我在gradle配置中添加了以下行:
ext['thymeleaf.version'] = '3.0.0.RELEASE'
ext['thymeleaf-layout-dialect.version'] = '2.0.0'