vue2.0学习小列子
参考地址:https://segmentfault.com/a/1190000006165434
例1:
- <template>
- <div id="app">
- <div class="main" v-cloak @click="hideTooltip">
- <div class="tooltip" v-if="show_tooltip" @click.stop>
- <input type="text" v-model="text_content">
- </div>
- <p @click.stop="toggleTooltip">{{text_content}}</p>
- </div>
- </div>
- </template>
- <script>
- /*import tab1 from './components/tabs/tab1.vue'
- import tab2 from './components/tabs/tab2.vue'*/
- export default {
- name: 'app',
- data(){
- return {
- show_tooltip:false,
- text_content:'Edit me'
- }
- },
- methods: {
- hideTooltip(){
- this.show_tooltip=false;
- },
- toggleTooltip(){
- this.show_tooltip=!this.show_tooltip;
- }
- }
- }
- </script>
- <style>
- *{
- padding:;
- margin:;
- box-sizing:border-box;
- }
- [v-cloak]{
- display: none;
- }
- #app {
- font-family: 'Avenir', Helvetica, Arial, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- /* text-align: center;
- color: #2c3e50;
- margin-top: 60px; */
- width:%;
- }
- .main{
- height:300px;
- position:relative;
- padding-top: 150px;
- }
- .tooltip{
- position:absolute;
- left:%;
- top:80px;
- width:290px;
- padding:10px;
- margin-left:-150px;
- border-radius: 3px;
- background-color: #5c9bb7;
- }
- .tooltip:after{
- content:'';
- position:absolute;
- left:%;
- width:;
- height:;
- bottom:-6px;
- border-left:6px solid transparent;
- border-right:6px solid transparent;
- border-top:6px solid #5190ac;
- }
- .tooltip input{
- border: none;
- width: %;
- line-height: 34px;
- border-radius: 3px;
- box-shadow: 2px 6px #bbb inset;
- text-align: center;
- font-size: 16px;
- font-family: inherit;
- color: #8d9395;
- font-weight: bold;
- outline: none;
- }
- p{
- font-size:22px;
- font-weight:bold;
- color:#6d8088;
- height: 30px;
- cursor:pointer;
- text-align: center;
- }
- p:before{
- content:'✎';
- display:inline-block;
- margin-right:5px;
- font-weight:normal;
- vertical-align: text-bottom;
- }
- </style>
例2
- <template>
- <div id="app">
- <div id="main">
- <nav>
- <a v-for="(item,index) in items" :class="{active:item.active}" @click="makeActive(item,index)">{{item.name}}</a>
- </nav>
- <p>You chose<b>{{active}}</b></p>
- </div>
- </div>
- </template>
- <script>
- /*import tab1 from './components/tabs/tab1.vue'
- import tab2 from './components/tabs/tab2.vue'*/
- export default {
- name: 'app',
- data(){
- return {
- active:'HTML',
- items:[
- {name:'HTML',active:true},
- {name:'CSS',active:false},
- {name:'Javascript',active:false},
- {name:'Vue.js',active:false}
- ]
- }
- },
- methods: {
- makeActive(item,index){
- this.active=item.name;
- for(var i=;i<this.items.length;i++){
- this.items[i].active=false
- }
- this.items[index].active=true
- }
- }
- }
- </script>
- <style>
- *{
- padding:;
- margin:;
- box-sizing:border-box;
- }
- [v-cloak]{
- display: none;
- }
- #app {
- font-family: 'Avenir', Helvetica, Arial, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- /* text-align: center;
- color: #2c3e50;
- margin-top: 60px; */
- width:%;
- }
- #main{
- width:432px;
- margin: auto;
- text-align: center;
- }
- nav{
- display: inline-block;
- margin:60px auto 45px;
- background-color:#5597b4;
- box-shadow: 1px 1px #ccc;
- border-radius:2px;
- }
- nav a{
- display: inline-block;
- padding:18px 30px;
- color:#fff !important;
- font-weight: bold;
- font-size:16px;
- text-decoration: none;
- line-height:;
- background-color: transparent;
- transition: background-color .25s;
- cursor:pointer;
- }
- b{
- display:inline-block;
- padding:5px 10px;
- background-color:#c4d7e0;
- border-radius:2px;
- font-size:18px;
- }
- .active{
- background:#ccc;
- }
- </style>
例3:
- <template>
- <div class="nav">
- <ul>
- <router-link tag="li" to="/home" active-class="active">
- <a href="javascript:;">首页</a>
- </router-link>
- <router-link to="/follow" tag="li" active-class="active">
- <a href="javascript:;">关注</a>
- </router-link>
- <router-link to="/column" tag="li" active-class="active">
- <a href="javascript:;">栏目</a>
- </router-link>
- </ul>
- </div>
- </template>
- <script>
- export default{
- }
- </script>
- <style scoped>
- .nav{
- width:100%;
- position:fixed;
- top:0;
- left:0;
- z-index:2;
- background:#fff;
- }
- .nav ul{
- width:4.38rem;
- height:0.6rem;
- margin:0 auto;
- }
- .nav li{
- width:1.46rem;
- height:0.6rem;
- line-height:0.6rem;
- float:left;
- text-align: center;
- box-sizing:border-box;
- }
- .nav li a{
- display:block;
- width:1.46rem;
- height:0.6rem;
- font-size:0.3rem;
- color:#9e9a95;
- text-decoration: none;
- }
- .nav li.active a{height:0.6rem; border-bottom:0.1rem solid #5477b2; color:#5477b2;}
- </style>
vue2.0学习小列子的更多相关文章
- vue2.0学习笔记之路由(二)路由嵌套+动画
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- vue2.0学习笔记之路由(二)路由嵌套
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- VUE2.0学习总结
摘要: 年后公司项目开始上vue2.0,自己对学习进行了总结,希望对大家有帮助! VUE2.0学习 vue介绍 vue是什么? https://vuefe.cn/guide vue也是一个数据驱动框架 ...
- Vue2.0学习--Vue数据通信详解
一.前言 组件是 vue.js最强大的功能之一,而组件实例的作用域是相互独立的,这就意味着不同组件之间的数据无法相互引用.组件间如何传递数据就显得至关重要.本文尽可能罗列出一些常见的数据传递方式,如p ...
- vue2.0学习教程
十分钟上手-搭建vue开发环境(新手教程)https://www.jianshu.com/p/0c6678671635 如何在本地运行查看github上的开源项目https://www.jianshu ...
- Vue2.0学习笔记一 :各种表达式
#,过滤器 #,在Vue2.x中,过滤器只能在mustache绑定中使用,为了在指令帮定中实现同样的行为,你应该使用计算属性: #,过滤器可以串联 {{ message | filterA | ...
- vue2.0学习(二)
1.关于模板渲染,当需要渲染多个元素时可以 <ul> <template v-for="item in items"> <li>{{ item. ...
- vue2.0 学习 ,开始学习
先看官网的介绍上面的教程 https://cn.vuejs.org/v2/guide/ 尝试 Vue.js 最简单的方法是使用 JSFiddle Hello World 例子.你可以在浏览器新标签 ...
- vue2.0 项目小总结
最近做了一个vue的PC端的项目,不大,真正用到vue的东西也不是太多,逻辑处理用到了不少原生js东西. 1.图片渲染 后台返回base64格式数据,一开始绑定src,提示pic字段未定义,懵逼了好久 ...
随机推荐
- oracle 收集的一些图
================================================ ================================================ da ...
- MySQL 删除数据库的两种方法
使用 mysqladmin 删除数据库 使用普通用户登陆mysql服务器,你可能需要特定的权限来创建或者删除 MySQL 数据库. 所以我们这边使用root用户登录,root用户拥有最高权限,可以使用 ...
- 洛谷:P1087 FBI树 P1030 求先序排列 P1305 新二叉树
至于为啥把这三个题放到一起,大概是因为洛谷的试炼场吧,三道树的水题,首先要理解 先序中序后序遍历方法. fbi树由于数量小,在递归每个区间时,暴力跑一遍区间里的数,看看是否有0和1.至于递归的方法,二 ...
- 20180129周一之学习PYTHON笔记【PYTHON2写个自动点击学习功能】
pyautogui.click(pyautogui.center(pyautogui.locateOnScreen('sy.png'))) #点击该截图一次 --------------------- ...
- CUDA C Programming Guide 在线教程学习笔记 Part 13
▶ 纹理内存访问补充(见纹理内存博客 http://www.cnblogs.com/cuancuancuanhao/p/7809713.html) ▶ 计算能力 ● 不同计算能力的硬件对计算特性的支持 ...
- VMware vCenter Server 6.5.0 U1g
VMware vCenter Server 6.5.0 U1gName: VMware-VCSA-all-6.5.0-8024368.iso Release Date: 2018-03-20 Buil ...
- Python 中一个逗号引发的悲剧
遇到一个 Python 字符串的坑,记录一下.看看下面这些代码 >>> a = [ ... 'foo' ... 'bar', ... 'tree' ... ] >>> ...
- localhost 127.0.0.1
No1: localhost也叫local ,正确的解释是:本地服务器 127.0.0.1在windows等系统的正确解释是:本机地址(本机服务器) 他们的解析通过本机的host文件,windows自 ...
- java 项目中类找不到异常解决办法
最后点击Apply and Close就可以了
- 进程队列(Queue),Pipe(管道), Manager 进行进程之间的数据传递和传输
进程Queue,实现进程传输的队列 1.Queue from multiprocessing import Process, Queue def f(q): q.put('1') q.put('2') ...