参考地址:https://segmentfault.com/a/1190000006165434

例1:

  1. <template>
  2. <div id="app">
  3. <div class="main" v-cloak @click="hideTooltip">
  4. <div class="tooltip" v-if="show_tooltip" @click.stop>
  5. <input type="text" v-model="text_content">
  6. </div>
  7. <p @click.stop="toggleTooltip">{{text_content}}</p>
  8. </div>
  9. </div>
  10. </template>
  11.  
  12. <script>
  13. /*import tab1 from './components/tabs/tab1.vue'
  14. import tab2 from './components/tabs/tab2.vue'*/
  15. export default {
  16. name: 'app',
  17. data(){
  18. return {
  19. show_tooltip:false,
  20. text_content:'Edit me'
  21. }
  22. },
  23. methods: {
  24. hideTooltip(){
  25. this.show_tooltip=false;
  26. },
  27. toggleTooltip(){
  28. this.show_tooltip=!this.show_tooltip;
  29. }
  30. }
  31. }
  32. </script>
  33.  
  34. <style>
  35. *{
  36. padding:;
  37. margin:;
  38. box-sizing:border-box;
  39. }
  40. [v-cloak]{
  41. display: none;
  42. }
  43. #app {
  44. font-family: 'Avenir', Helvetica, Arial, sans-serif;
  45. -webkit-font-smoothing: antialiased;
  46. -moz-osx-font-smoothing: grayscale;
  47. /* text-align: center;
  48. color: #2c3e50;
  49. margin-top: 60px; */
  50. width:%;
  51. }
  52. .main{
  53. height:300px;
  54. position:relative;
  55. padding-top: 150px;
  56. }
  57. .tooltip{
  58. position:absolute;
  59. left:%;
  60. top:80px;
  61. width:290px;
  62. padding:10px;
  63. margin-left:-150px;
  64. border-radius: 3px;
  65. background-color: #5c9bb7;
  66. }
  67. .tooltip:after{
  68. content:'';
  69. position:absolute;
  70. left:%;
  71. width:;
  72. height:;
  73. bottom:-6px;
  74. border-left:6px solid transparent;
  75. border-right:6px solid transparent;
  76. border-top:6px solid #5190ac;
  77. }
  78. .tooltip input{
  79. border: none;
  80. width: %;
  81. line-height: 34px;
  82. border-radius: 3px;
  83. box-shadow: 2px 6px #bbb inset;
  84. text-align: center;
  85. font-size: 16px;
  86. font-family: inherit;
  87. color: #8d9395;
  88. font-weight: bold;
  89. outline: none;
  90. }
  91. p{
  92. font-size:22px;
  93. font-weight:bold;
  94. color:#6d8088;
  95. height: 30px;
  96. cursor:pointer;
  97. text-align: center;
  98. }
  99. p:before{
  100. content:'✎';
  101. display:inline-block;
  102. margin-right:5px;
  103. font-weight:normal;
  104. vertical-align: text-bottom;
  105. }
  106. </style>

例2

  1. <template>
  2. <div id="app">
  3. <div id="main">
  4. <nav>
  5. <a v-for="(item,index) in items" :class="{active:item.active}" @click="makeActive(item,index)">{{item.name}}</a>
  6. </nav>
  7. <p>You chose<b>{{active}}</b></p>
  8. </div>
  9. </div>
  10. </template>
  11.  
  12. <script>
  13. /*import tab1 from './components/tabs/tab1.vue'
  14. import tab2 from './components/tabs/tab2.vue'*/
  15. export default {
  16. name: 'app',
  17. data(){
  18. return {
  19. active:'HTML',
  20. items:[
  21. {name:'HTML',active:true},
  22. {name:'CSS',active:false},
  23. {name:'Javascript',active:false},
  24. {name:'Vue.js',active:false}
  25. ]
  26. }
  27. },
  28. methods: {
  29. makeActive(item,index){
  30. this.active=item.name;
  31. for(var i=;i<this.items.length;i++){
  32. this.items[i].active=false
  33. }
  34. this.items[index].active=true
  35. }
  36. }
  37. }
  38. </script>
  39.  
  40. <style>
  41. *{
  42. padding:;
  43. margin:;
  44. box-sizing:border-box;
  45. }
  46. [v-cloak]{
  47. display: none;
  48. }
  49. #app {
  50. font-family: 'Avenir', Helvetica, Arial, sans-serif;
  51. -webkit-font-smoothing: antialiased;
  52. -moz-osx-font-smoothing: grayscale;
  53. /* text-align: center;
  54. color: #2c3e50;
  55. margin-top: 60px; */
  56. width:%;
  57. }
  58. #main{
  59. width:432px;
  60. margin: auto;
  61. text-align: center;
  62. }
  63. nav{
  64. display: inline-block;
  65. margin:60px auto 45px;
  66. background-color:#5597b4;
  67. box-shadow: 1px 1px #ccc;
  68. border-radius:2px;
  69. }
  70. nav a{
  71. display: inline-block;
  72. padding:18px 30px;
  73. color:#fff !important;
  74. font-weight: bold;
  75. font-size:16px;
  76. text-decoration: none;
  77. line-height:;
  78. background-color: transparent;
  79. transition: background-color .25s;
  80. cursor:pointer;
  81. }
  82. b{
  83. display:inline-block;
  84. padding:5px 10px;
  85. background-color:#c4d7e0;
  86. border-radius:2px;
  87. font-size:18px;
  88. }
  89. .active{
  90. background:#ccc;
  91. }
  92. </style>

例3:

  1. <template>
  2. <div class="nav">
  3. <ul>
  4. <router-link tag="li" to="/home" active-class="active">
  5. <a href="javascript:;">首页</a>
  6. </router-link>
  7. <router-link to="/follow" tag="li" active-class="active">
  8. <a href="javascript:;">关注</a>
  9. </router-link>
  10. <router-link to="/column" tag="li" active-class="active">
  11. <a href="javascript:;">栏目</a>
  12. </router-link>
  13. </ul>
  14. </div>
  15. </template>
  16. <script>
  17. export default{
  18.  
  19. }
  20. </script>
  21. <style scoped>
  22. .nav{
  23. width:100%;
  24. position:fixed;
  25. top:0;
  26. left:0;
  27. z-index:2;
  28. background:#fff;
  29. }
  30. .nav ul{
  31. width:4.38rem;
  32. height:0.6rem;
  33. margin:0 auto;
  34. }
  35. .nav li{
  36. width:1.46rem;
  37. height:0.6rem;
  38. line-height:0.6rem;
  39. float:left;
  40. text-align: center;
  41. box-sizing:border-box;
  42. }
  43. .nav li a{
  44. display:block;
  45. width:1.46rem;
  46. height:0.6rem;
  47. font-size:0.3rem;
  48. color:#9e9a95;
  49. text-decoration: none;
  50. }
  51. .nav li.active a{height:0.6rem; border-bottom:0.1rem solid #5477b2; color:#5477b2;}
  52. </style>

vue2.0学习小列子的更多相关文章

  1. vue2.0学习笔记之路由(二)路由嵌套+动画

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. vue2.0学习笔记之路由(二)路由嵌套

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. VUE2.0学习总结

    摘要: 年后公司项目开始上vue2.0,自己对学习进行了总结,希望对大家有帮助! VUE2.0学习 vue介绍 vue是什么? https://vuefe.cn/guide vue也是一个数据驱动框架 ...

  4. Vue2.0学习--Vue数据通信详解

    一.前言 组件是 vue.js最强大的功能之一,而组件实例的作用域是相互独立的,这就意味着不同组件之间的数据无法相互引用.组件间如何传递数据就显得至关重要.本文尽可能罗列出一些常见的数据传递方式,如p ...

  5. vue2.0学习教程

    十分钟上手-搭建vue开发环境(新手教程)https://www.jianshu.com/p/0c6678671635 如何在本地运行查看github上的开源项目https://www.jianshu ...

  6. Vue2.0学习笔记一 :各种表达式

    #,过滤器 #,在Vue2.x中,过滤器只能在mustache绑定中使用,为了在指令帮定中实现同样的行为,你应该使用计算属性:     #,过滤器可以串联 {{ message | filterA | ...

  7. vue2.0学习(二)

    1.关于模板渲染,当需要渲染多个元素时可以 <ul> <template v-for="item in items"> <li>{{ item. ...

  8. vue2.0 学习 ,开始学习

    先看官网的介绍上面的教程   https://cn.vuejs.org/v2/guide/ 尝试 Vue.js 最简单的方法是使用 JSFiddle Hello World 例子.你可以在浏览器新标签 ...

  9. vue2.0 项目小总结

    最近做了一个vue的PC端的项目,不大,真正用到vue的东西也不是太多,逻辑处理用到了不少原生js东西. 1.图片渲染 后台返回base64格式数据,一开始绑定src,提示pic字段未定义,懵逼了好久 ...

随机推荐

  1. oracle 收集的一些图

    ================================================ ================================================ da ...

  2. MySQL 删除数据库的两种方法

    使用 mysqladmin 删除数据库 使用普通用户登陆mysql服务器,你可能需要特定的权限来创建或者删除 MySQL 数据库. 所以我们这边使用root用户登录,root用户拥有最高权限,可以使用 ...

  3. 洛谷:P1087 FBI树 P1030 求先序排列 P1305 新二叉树

    至于为啥把这三个题放到一起,大概是因为洛谷的试炼场吧,三道树的水题,首先要理解 先序中序后序遍历方法. fbi树由于数量小,在递归每个区间时,暴力跑一遍区间里的数,看看是否有0和1.至于递归的方法,二 ...

  4. 20180129周一之学习PYTHON笔记【PYTHON2写个自动点击学习功能】

    pyautogui.click(pyautogui.center(pyautogui.locateOnScreen('sy.png'))) #点击该截图一次 --------------------- ...

  5. CUDA C Programming Guide 在线教程学习笔记 Part 13

    ▶ 纹理内存访问补充(见纹理内存博客 http://www.cnblogs.com/cuancuancuanhao/p/7809713.html) ▶ 计算能力 ● 不同计算能力的硬件对计算特性的支持 ...

  6. 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 ...

  7. Python 中一个逗号引发的悲剧

    遇到一个 Python 字符串的坑,记录一下.看看下面这些代码 >>> a = [ ... 'foo' ... 'bar', ... 'tree' ... ] >>> ...

  8. localhost 127.0.0.1

    No1: localhost也叫local ,正确的解释是:本地服务器 127.0.0.1在windows等系统的正确解释是:本机地址(本机服务器) 他们的解析通过本机的host文件,windows自 ...

  9. java 项目中类找不到异常解决办法

    最后点击Apply and Close就可以了

  10. 进程队列(Queue),Pipe(管道), Manager 进行进程之间的数据传递和传输

    进程Queue,实现进程传输的队列 1.Queue from multiprocessing import Process, Queue def f(q): q.put('1') q.put('2') ...