在Vue的webpack中结合runder函数
2024-10-14 01:07:02
在Vue的webpack中结合runder函数
1.引入:
<h1>下面是vue的内容:</h1>
<div id="app">
<login></login>
</div>
2.main.js
//默认无法打包vue文件 需安装vue-loader
import Vue from 'vue'
import login from './login.vue'
var vm = new Vue({
el:"#app",
data:{
msg:'123'
},
// components:{
// 'login':login
// },
render:function (createElement) { //在webpack中如果需要vue放到页面中展示 vm实例中的render函数可以实现
return createElement(login)
}
})
3.拉取相关的loader
npm i vue-loader vue-template-compiler -D
4.在webpack.config.js中加入
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
devtool: "sourcemap",
entry: './js/entry.js', // 入口文件
output: {
filename: 'bundle.js' // 打包出来的wenjian
},
plugins: [
// make sure to include the plugin for the magic
new VueLoaderPlugin()
],
module : {
...
}
}
最新文章
- GitHub实战系列汇总篇
- mac下生成ssh keys 并上传github仓储
- 【codevs2495】 水叮当的舞步
- JAVA 8 方法引用 - Method References
- Nginx简单实现网站的负载均衡
- java虚拟机参数设置
- php odbc连接 查询显示不完整问题
- How does browsersync work?
- hdu1230火星A+B (大数题)
- jquery keyup 在IOS设备上输入中文时不触发
- (原创)android4.4沉浸式标题栏
- Unity 调用android插件
- 使用SndPlaySound从内存中播放WAV
- Mysql innodb 后台的7大线程与3大内存
- DVWA 黑客攻防演练(九) SQL 盲注 SQL Injection (Blind)
- Yii1自定义 CGridView 中的操作按钮中 CButtonColumn 选项
- js 生成随机颜色
- BZOJ 3174 拯救小矮人(贪心+DP)
- 【StatLearn】统计学习中knn算法实验(2)
- [翻译] USING GIT IN XCODE [1] 在XCODE中使用GIT[1]