在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 : {

    ...

}

}

最新文章

  1. GitHub实战系列汇总篇
  2. mac下生成ssh keys 并上传github仓储
  3. 【codevs2495】 水叮当的舞步
  4. JAVA 8 方法引用 - Method References
  5. Nginx简单实现网站的负载均衡
  6. java虚拟机参数设置
  7. php odbc连接 查询显示不完整问题
  8. How does browsersync work?
  9. hdu1230火星A+B (大数题)
  10. jquery keyup 在IOS设备上输入中文时不触发
  11. (原创)android4.4沉浸式标题栏
  12. Unity 调用android插件
  13. 使用SndPlaySound从内存中播放WAV
  14. Mysql innodb 后台的7大线程与3大内存
  15. DVWA 黑客攻防演练(九) SQL 盲注 SQL Injection (Blind)
  16. Yii1自定义 CGridView 中的操作按钮中 CButtonColumn 选项
  17. js 生成随机颜色
  18. BZOJ 3174 拯救小矮人(贪心+DP)
  19. 【StatLearn】统计学习中knn算法实验(2)
  20. [翻译] USING GIT IN XCODE [1] 在XCODE中使用GIT[1]

热门文章

  1. C语言中 指针的基础知识总结, 指针数组的理解
  2. 整理iOS9适配中出现的坑
  3. centos7 源码安装python3
  4. [Linux-vi] The simple set of vi command
  5. windows eclipse IDE打开当前类所在文件路径
  6. WebApi使用JWT认证(一)
  7. html5 app开发
  8. Checkpoint--查看各DB上的脏页
  9. Create Index语句的Include作用
  10. signalR常见问题