ldlood同学推荐ui元素(饿了么基于vue出品)也不错,github地址:https://github.com/ElemeFE/element。大家也可以关注一下
我是一个刚刚接触前端开发的新手,所以有必要记录如何将引导和Vue进行整合。如果你是老手,请直接绕道而过。作为一个新手,里面的步骤,过程或者专业术语未必正确,如果你发现哪里错误了,请发邮件至ztao8607@gmail.com
Vue官方不建议新手直接使用vue-cli,但我不这么看。先使用cli跳过繁琐的环境配置,直接看到演示效果能增强点自信心。如果上手就被一大堆的环境配置搞乱了心情,那才是得不偿失呢,恩。至少我是这么认为的。
如果是使用国内网络安装,官方建议使用淘宝或者cnpmjs的镜像。我感觉淘宝的镜像速度不如cnpmjs的快,因为我使用的cnpmjs镜像。
npm——注册http://r.cnpmjs.org安装全球vue-cli//安装vue-cli vue init webpack & lt;项目name>//创建项目,一般情况使用默认配置就可以 cd & lt;项目name> npm——注册http://r.cnpmjs.org安装//安装包 npm运行dev
正常的话,你应该能看到一个vue的初始化页面。
你可以选择下载引导zip包,然后将包里面的内容放到工程的静态目录中。也可以选择使用引导cdn资源,我建议使用cdn资源。
1。修改index . html页面
& lt; !DOCTYPE html> & lt; html> & lt; head> & lt;元charset=皍tf - 8”比; & lt; title> testproject & lt; !——将引导cdn url放到这里——比; & lt;链接rel="样式表" href=" https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css " rel=巴獠縩ofollow”诚信=皊ha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va + PmSTsz/K68vbdEjh5u”crossorigin=澳涿北? & lt;链接rel="样式表" href=" https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap-theme.min.css " rel=巴獠縩ofollow”诚信=皊ha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp”crossorigin=澳涿北? & lt;/head> & lt; body> & lt; div id="应用"祝辞& lt;/div> & lt; !——构建文件将自动注入比; & lt;/body> & lt;/html>
你可以访问引导官方网站获取到最新的cdn资源地址。
2。创建布局
我们创建一个使用引导栅格布局的例子。在src/组件目录中创建一个Root.vue文件。在Root.vue文件中,我们先编辑模板,创建一个容器,然后放入一些导航栏。
里面布局代码来自于引导官方提供的演示
& lt; template> & lt; div id=案北? & lt; div类="容器"比; & lt; div类=氨ㄍ贰北? & lt; h4类=" text-muted "在寻找它! & lt;/h4> & lt; nav> & lt; ul类=皀av nav-justified”比; & lt;李类="活跃"祝辞& lt; a href=" https://www.yisu.com/zixun/" rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”祝辞Home & lt;/li> & lt; li> & lt; a href=" https://www.yisu.com/zixun/" rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”祝辞Projects & lt;/li> & lt; li> & lt; a href=" https://www.yisu.com/zixun/" rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”祝辞Services & lt;/li> & lt; li> & lt; a href=" https://www.yisu.com/zixun/" rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”祝辞Downloads & lt;/li> & lt; li> & lt; a href=" https://www.yisu.com/zixun/" rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”rel=巴獠縩ofollow”祝辞AboutVue和引导的整合思路详解