VUE真實項目中常用的生命周期和參數


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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM