2017-06-01 51 views
0

任何人在通過thymeleaf爲HTML標籤使用特殊屬性時都會遇到錯誤?特殊屬性中的Thymeleaf和Vuejs集成錯誤

實施例: Thymeleaf將使用該HTML代碼,

<div class="draggable-header-view" 
    @mousedown="startDrag" @touchstart="startDrag" 
    @mousemove="onDrag" @touchmove="onDrag" 
    @mouseup="stopDrag" @touchend="stopDrag" @mouseleave="stopDrag"> 
</div> 

@mousedown等也使用vuejs。

但是,當Thymeleaf將使用此HTML代碼時,將出現Exception解析文檔。

我的猜測是@在Thymeleaf是一個保留關鍵字。它用於@ {值}。 但@也用於vuejs。

有人能夠爲此做一些解決方法嗎?

謝謝。

+0

歡迎#1,它是有點不清楚,你問哪個圖書館,和你的問題。請編輯您的問題以使其更加清晰,並添加更多關於您遇到問題的詳細信息。 –

回答

0

我不知道你使用的是什麼技術,但如果它只是你建議的禁止@問題,請注意,它只是v-on:的快捷方式。

所以,你應該能夠把它這樣寫:

<div class="draggable-header-view" 
    v-on:mousedown="startDrag" v-on:touchstart="startDrag" 
    v-on:mousemove="onDrag" v-on:touchmove="onDrag" 
    v-on:mouseup="stopDrag" v-on:touchend="stopDrag" 
    v-on:mouseleave="stopDrag"> 
</div> 
+0

哇,非常感謝。我不知道@是v-on的捷徑:我的代碼現在可以運行。 – GenoBear

+0

如果這個答案解決了問題,那麼我想你可以將它標記爲已接受! :) – Cobaltway

+0

對不起,我不知道如何接受。這是我第一次在這裏張貼在stackoverflow – GenoBear