javascript |
您所在的位置:网站首页 › vue怎么引用js文件 › javascript |
html页面引入vue组件需要在页面引入http-vue-loader.js 注意:要查看页面引入vue组件的效果不能直接在本地打开index.html,会有跨域问题,可以在本地配置一个nginx转发,再用浏览器访问http://localhost:port/index.html 1.创建my-component.vue Hello {{who}} module.exports = { data: function() { return { who: 'world' } } } .hello { background-color: #ffe; }2.创建index.html // 使用httpVueLoader Vue.use(httpVueLoader); new Vue({ el: '#app', data: function () { return { visible: false } }, components: { // 将组建加入组建库 'my-component': 'url:./component/my-component.vue' } })注意:要查看页面引入vue组件的效果不能直接在本地打开index.html,会有跨域问题,可以在本地配置一个nginx转发,再用浏览器访问http://localhost:port/index.html httpVueLoader的其他组件载入方式可查看:https://www.npmjs.com/package/http-vue-loader 转自:https://www.cnblogs.com/new-l... |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |