我在我的index.html文件中有很多腳本,它們包含我所有的Ractive腳本。我想知道是否有某種方法來組織這一切,並將這些腳本放在不同的html或js文件中。有沒有辦法在不同的html或js文件中分離ractive腳本?
這裏就是我的意思是:
//index.html
<script type="text/html" id="template-1">
...content...
</script>
<script type="text/html" id="template-2">
...content...
</script>
<script type="text/html" id="template-3">
...content...
</script>
這裏就是我試圖完成
//template1.html or js
<script type="text/html" id="template-1">
...content...
</script>
//template2.html or js
<script type="text/html" id="template-2">
...content...
</script>
//template3.html or js
<script type="text/html" id="template-3">
...content...
</script>
我曾嘗試做這種方式,而我得到的錯誤,因爲我ractive對象是在我的指數.html,並且無法包含其他html文件。我確信其他人以前有過這個問題,這可能嗎?
你看着使用Ractive組件? – martypdx
是的,但不允許爲每個邏輯分開。 – Omeed