码迷,mamicode.com
首页 > 其他好文 > 详细

VUE真实项目中常用的生命周期和参数

时间:2020-01-08 18:56:53      阅读:113      评论:0      收藏:0      [点我收藏+]

标签:ext   script   welcome   app   size   temp   data   mes   rom   

<template>
  <div class="first-app">
  {{msg}}
  <br/>
  {{msg1}}
  <Confin text=‘注册‘ @message="getMeaasge"></Confin>
  </div>
</template>
<script>
import Confin from ‘@/components/sub/Confin‘;
export default {
  name: ‘Fist‘,
  components: {Confin}, //注册组件,比如要插入另外一个写好的VUE文件买这个时候就需要添加
  props:[], //接受父亲的参数
  data () { 
    return {
      msg: ‘Welcome to Your FistApp ddddd‘
    }
  },
  mounted(){ //dom挂在完成 相当于onload,方法的调用
    //this.getMeaasge();
  },
  computed:{ //计算属性
    msg1(){
      return this.msg+‘1‘;
    }
  },
  methods:{ //这里面添加所有的方法
    getMeaasge(val){
      alert(val)
    }
  }
}
</script>
<style>
.first-app{
  color:#f00;
  font-size:40px;
}
</style>

 

VUE真实项目中常用的生命周期和参数

标签:ext   script   welcome   app   size   temp   data   mes   rom   

原文地址:https://www.cnblogs.com/binmengxue/p/12168067.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!