Vue2.0 模块组件的引入
index.js:
import NoDataS from './index.vue'
const noDataLists = {
install: function(Vue) {
// 注册并获取组件,然后在main.js中引用,在Vue.use()就可以了
Vue.component('noDataLists', NoDataS)
}
}
export default noDataLists
index.vue:
<template>
<!-- NoDataWords 可以灵活控制每个页面显示的内容 -->
<!-- NoDataHeight 可以灵活控制每个页面的高度 -->
<!-- 如果你的页面都是统一的字体,统一的样式,那就直接在这写死就好了 -->
<div class="NoDataAtAll W100"
:style="{height: NoDataHeight }">{{NoDataWords}}</div>
</template>
<script>
export default {
// 就是基本的父子组件传值
props: ["NoDataHeight", "NoDataWords"],
data() {
return {};
},
methods: {}
};
</script>
<style lang="scss" scoped>
.NoDataAtAll {
font-size: 14px;
color: #909399;
}
</style>
main.js:引入
HTML页面:
<script type="module" src="js/main.js"></script>
现在就是一直报错:
Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
不知道是index.vue没有规范化吗
import NoDataS from './index.vue'
const noDataLists = {
install: function(Vue) {
// 注册并获取组件,然后在main.js中引用,在Vue.use()就可以了
Vue.component('noDataLists', NoDataS)
}
}
export default noDataLists
index.vue:
<template>
<!-- NoDataWords 可以灵活控制每个页面显示的内容 -->
<!-- NoDataHeight 可以灵活控制每个页面的高度 -->
<!-- 如果你的页面都是统一的字体,统一的样式,那就直接在这写死就好了 -->
<div class="NoDataAtAll W100"
:style="{height: NoDataHeight }">{{NoDataWords}}</div>
</template>
<script>
export default {
// 就是基本的父子组件传值
props: ["NoDataHeight", "NoDataWords"],
data() {
return {};
},
methods: {}
};
</script>
<style lang="scss" scoped>
.NoDataAtAll {
font-size: 14px;
color: #909399;
}
</style>
main.js:引入
HTML页面:
<script type="module" src="js/main.js"></script>
现在就是一直报错:
Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
不知道是index.vue没有规范化吗
...全文
相关推荐
一个用于将kindergarten整合到VueJS应用程序中的VueJS20插件
一个用于将kindergarten整合到VueJS应用程序中的VueJS2.0插件
vue2.0中文离线官网文档(手册,教程,api)
vue.js2.0中文文档离线版是一款十分实用的使用教程,专门详细地介绍了vue.js,从基础、进阶和迁移三大方面进行讲述,能够让用户由浅入深,逐渐了解和掌握相关知识,有需要的朋友不妨来下载!
一个用vuejs20写的直播类应用web端个人中心
一个用vue.js(2.0)写的直播类应用web端个人中心
vuejsFormation-level1
VueJs 1级 1.1.1:版本05/20/2019 2.0.0:版本09/04/2019 添加vuex(可能在3天内通过)
VUE2.0入门视频11
VUE2.0入门视频第十一课,看完全部视频就能学会VUE,理解以后就能精通,简单易懂易学!(入门篇审核全通过后,将上传VUE2.0进阶篇)


