vue--项目实例

1.项目创建和GitHub托管

 脚手架3     跑起来

GitHub创建项目:右上角+号--填写信息

在vscode这边  git clone 'github上的项目链接' ------>创建好了托管的文件,再把一些文件复制进去---->cd到要托管的文件目录下--->git add . ---->git commit -m '初始化项目'  -->提示“Please tell me who you are. Run  git config --global user.email "you@example.com"  git config --global user.name "Your Name” 于是git config --global user.email "107的邮箱@qq.com"       git config --global user.name "pys" ------>git push

github应用

文件夹的建立 

src--assets:资源 放一些资源 img/css
src--component放公共的 组件 src下建个views把大的视图放在这里以防止组件内容过多
src-router:路由
src--store:状态管理
network:跟网络有关
common:放些公共js文件

css/normalize : https://github.com/necolas/normalize.css.git 各个浏览器的兼容性 用处很大很多

走个项目

用vue-cli3创建项目 vue create xxx 这里只能是全小写

name can no longer contain capital letters

在gitHub上创建了项目之后 将二者联系起来

PS D:VueVue-cli7-program> git clone GitHub项目的地址 Cloning into 'SuperMall0922'... 就将vscode上的代码克隆进了GitHub上的

git add . git commit -m '我的项目' 将项目提交到了本地       git push提交到服务器

使用插件

通过 Vue.use() 全局方法使用插件

已有插件 & 工具

  • vue-router:Vue.js 官方路由。与 Vue.js 内核深度整合,让构建单页应用易如反掌。

  • vue-resource:通过 XMLHttpRequest 或 JSONP 发起请求并处理响应。

  • vue-async-data:异步加载数据插件。

  • vue-validator:表单验证插件。

  • vue-devtools:Chrome 开发者工具扩展,用于调试 Vue.js 应用。

  • vue-touch:使用 Hammer.js 添加触摸手势指令(已过时)。

  • vue-element:使用 Vue.js 注册自定义元素。

我他妈为什么一直在踩坑啊

 报错: vue-router.esm.js?8c4f:2051 Uncaught (in promise) NavigationDuplicated {_name: "NavigationDuplicated", name: "NavigationDuplicated", message: "Navigating to current location ("/home") is not allowed", stack: "Error↵    at new NavigationDuplicated (webpack-int…node_modules/vue/dist/vue.runtime.esm.js:2178:14)"}

原文地址:https://www.cnblogs.com/yundong333/p/11517718.html