美文网首页
2018-10-09 vue的简单复习

2018-10-09 vue的简单复习

作者: LYH2312 | 来源:发表于2018-10-09 18:58 被阅读0次

主流框架

vue angular react

1.vue简介

简化Dom操作

2.vue指令

 v-for=""  循环操作

 v-model=""  双向数据绑定  用于表单元素

 v-on:事件="函数名"       绑定事件  简写 @事件=""

 v-show="" 控制元素的显示或隐藏  display:none

 v-if=""   。。。。。。。。。。  visibility:hidden;

 v-else
 v-else-if   
 
 v-bind:属性='值'   绑定属性  简写 :属性='值'

 v-text  不可以解析标签

 v-html  可以解析标签

 v-once  只绑定一次

 v-pre   原样输出

 v-cloak  

3.vue过滤器

  全局:
  局部:

4.vue计算属性

    处理复杂逻辑操作

5.vue中的组件 (重要)

 作用:
    1.扩张html元素
    2.封装可重用的代码

6.组件之间的传值(难,重)

1.父传子  用属性  props:['属性']
2.子传父  用事件传  $emit
3.非父子   借助中间量

7.路由(路由的嵌套,路由的传参

8.vue中的ajax axios

-->
<div id='app'>


<my-component></my-component>

</div>

<script src='js/vue.js'></script>

<script>

//组件
    Vue.component('my-component',{
        template:`

         <div>
             <h1>这是my-component组件</h1>
             <a href="">{{msg}}</a>
             <my-child v-bind:mess='txt' @send="rcvMsg"></my-child>
           
         </div>
        `,
        data:function(){
            return{
                txt:'hello component',
                msg:''
            }
        },
        methods:{
            rcvMsg:function(a){
                this.msg=a
            }
        }
    })
    
      Vue.component('my-child',{
        props:['mess'],
        template:`

         <div>
            <h1>my-child组件</h1>
            <a href="">{{mess}}</a>
            <button @click="sendMsg">发送</button>
         </div>

        `,
          data:function(){

            return{
                text:'我是子组件中的数据,要在福组件中显示'
            }

        },
        methods:{

            sendMsg:function(){
                this.$emit('send',this.text)
            }

        }
    })
    
    //全局过滤器

    Vue.filter('过滤器的名字',function(data){
        return
    })
    new Vue({//vue实例

        el:'#app'//选择器

//        data:{//专门存放数据

//            msg:"hello vue",

//            arr:[],

//            obj:{}
//            
//        },
//        methods:{//专门存放方法

//            alet:function(){

//                alert(111)

//            }
//        },
//        filters:{//局部过滤器

//            过滤器的名字:function(data){

//                 return  
  
//            }
//        },
//        computed:{

//            名字:function(){

//                return // 逻辑操作

//            }
//        },
//        components:{

//            '组件名':{

//                template:``

//            }
//        }
        
    })

相关文章

  • 2018-10-09 vue的简单复习

    主流框架 vue angular react 1.vue简介 简化Dom操作 2.vue指令 3.vue过滤器 ...

  • 灵感之倩女幽魂写真集

    2018-10-09

  • 2018-10-23

    复习js的逻辑,学习vue

  • Vue 复习

    1.vue 简介简化DOM操作2.vue 指令1).v-for="" 循环操作 2).v-model="" ...

  • vue 复习

    1.vue简介简化Dom操作2.vue指令(1)v-for="" 循环操作 (2)v-model="" 双向数...

  • Vue复习

    Vue的计算属性 计算属性computed

  • vue复习

    父传子 1.在父组件里(创建子组件的同时,定义v-bind="content传父组件的数据") 2.子组件通过pr...

  • vue框架视频学习第二天笔记

    vue视频学习第二天笔记 复习 vue单文件方式 xxx.vue格式:template script style(...

  • vue全解:computed和watch

    进阶属性复习options里面有什么 会被vue监听 option.data傳給vue后呢,data会被vue监听...

  • 简单复习

    鉴证业务要素:鉴证业务的三方关系、鉴证对象、标准、证据、鉴证报告。监控。 质量控制制度要素:注册会计师承担的领导责...

网友评论

      本文标题:2018-10-09 vue的简单复习

      本文链接:https://www.haomeiwen.com/subject/keuyaftx.html