Why is the vue <template> invalid with v-bind:src?
问题 I want to dynamically switch html content, so I used vue-loader src to import, but v-bind:src doesn't take effect at all. <template src="./app.html"></template> Ok,effective <template :src="getDOM(true)"></template> getDOM(a){ if(a){ return './app.html' } else { return './app2.html' } } Not active. So, what can I do to achieve this effect? 回答1: It seems like you need to use Vue dynamic components https://vuejs.org/v2/guide/components.html#Dynamic-Components You can make a couple of components