如何在html.js文件中使用vue组件

1.     html中引入 http-vue-loader.js

  下载地址等详情访问: https://www.npmjs.com/package/http-vue-loader

  html中写法和vue中一样

  <multisearch ref="multiSearchRef" ></multisearch>

2.   js中使用方法

Vue.use(httpVueLoader)
var vm = new Vue({   
  el: '#app',   
  components: {
    'multisearch': httpVueLoader('../../../compoent/multipleSearch.vue'),
  },
}

3 vue文件 请注意 和平时快捷键生成的文件不太一样  

<template>
    <div class="hello">Hello {{who}}</div>
</template>
 
<script>
module.exports = {
    data: function() {
        return {
            who: 'world'
        }
    }
}
</script>
 
<style>
</style>
原文地址:https://www.cnblogs.com/guozhe/p/14942175.html