html中使用vue 和 vue模块
#### 在Vue中使用http-vue-loader加载组件
要使用vue组件的话,需要引入http-vue-loader.js 要在服务器的环境下打开 开发时本地服务器 或 idea打开
HTML结构
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> *{ padding: 0; margin: 0; } </style> </head> <body> <section id="app"> <my-component></my-component> <section @click="clockss"> {{title}} </section> </section> <script src="/js/vue/vue2614.js"></script> <script src="/js/vue/http-vue-loade.js"></script> <script> // 使用httpVueLoader Vue.use(httpVueLoader); new Vue({ el: '#app', data: { title: '111' }, methods: { clockss() { } }, components: { // 将组建加入组建库 'my-component': 'url:./app/components/my-component.vue' // 加载外部的Vue组件 } }) </script> </body> </html>
Vue组件 - my-component
<template> <div class="hello">Hello {{who}}</div> </template> <script> module.exports = { data: function() { return { who: 'world223232' // 初始化who变量 } } } </script> <style> .hello { background-color: #ffe; // 定义hello类的样式 } </style>
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 【.NET】调用本地 Deepseek 模型
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
2020-03-10 flutter 页面布局 SizedBox ConstrainedBox LimitedBox AspectRatio FractionallySizedBox