如何在CDN中导入“ .vue”文件?
我尝试在“ ASP.NET Framework MVC + vue.js cdn”中导入“ .vue”
@{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="https://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-12">
<div id="example">
<my-component></my-component>
<my-component></my-component>
<my-component></my-component>
<my-component2></my-component2>
</div>
</div>
</div>
<script src="/Scripts/vue.js"></script>
<script>
var Child = {
template: '<div>This is a user-defined component!</div>'
}
new Vue({
el: '#example',
// ...
components: {
'my-component': () => import('Test.vue'),// This is problem
'my-component2': Child//It worked
}
})
</script>
我遇到以下错误:
vue.js:634 [Vue警告]:无法解析异步组件:()=> import('Test.vue')原因:TypeError:无法解析模块 说明符“ Test.vue”