.csthml檔案和.vue在同一個目錄下
<html lang="en">
<head>
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/http-vue-loader"></script>
</head>
<body>
<div id="my-app">
<my-component></my-component>
</div>
<script type="text/javascript">
new Vue({
el: '#my-app',
components: {
'my-component': httpVueLoader('my-component.vue')
}
});
</script>
</body>
</html>
F12里network里面提示my-component.vue 404,是哪里還需要配置嗎?
uj5u.com熱心網友回復:
這個問題的原因主要和vue無關,是mvc找不到.vue格式的檔案,解決方法是在,webconfig組態檔中加個配置。<system.webServer>
<staticContent>
<mimeMap fileExtension=".vue" mimeType="application/x-javascript" />
</staticContent>
</system.webServer>
這樣就能找到了。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/43151.html
標籤:ASP.NET
