zoukankan      html  css  js  c++  java
  • 在Vue的webpack中结合runder函数

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

  • 相关阅读:
    判断一个数是否为素数的方法
    什么是算法?
    table 表格
    状态模式
    设计模式
    观察者模式
    async函数
    JS单线程和异步
    ES6 --- Promise
    浅析flex 布局
  • 原文地址:https://www.cnblogs.com/charlypage/p/9949685.html
Copyright © 2011-2022 走看看