IndexHead.vue:
< template >
<div>
<div class="menu">
</div>
<div class="head_menu">
<span></span>
<a href="javascript:void(0)"></a>
<a href="javascript:void(0)"> |</a>
<a href="javascript:void(0)"></a>
<div class="menulist">
</div>
<ul class="contenttypemenu">
<li v-for="(contype,index) in contenttype" @click=changecontent(index)>{{contype.typename}}</li>
</ul>
</div>
</div>
< / template >
< script >
export default {
name: "my-comp"
}
< / script >
myblog.js:
import MyComp from". / components/IndexHead.vue";
const Comp = {
install: function(Vue){
Vue.component("Comp", MyComp)
}
};
export default Comp
webpack.config.js:
var webpack = require ("webpack");
var path = require ("path");
module.exports = {
entry:"D:\\My job\\MyBlog\\js\\myblog.js",
output:{
path:path.resolve(__dirname,"dist"),
filename:"bundle.js"
},
module:{
rules:[
{test:/\.(vue|js)$/,loader:"babel-loader"}
]
}
}