-
接收父組件參數(shù)props,并且監(jiān)聽參數(shù)變化watch
查看全部 -
父子組件中的參數(shù)傳遞
在組件中設(shè)置參數(shù),例如
<GoodList?:GoodId="1"></GoodList>
查看全部 -
第一步:vue-cli2安裝
安裝結(jié)束后,通過 vue -V 來查看版本號(hào)。(-V大寫)
查看全部 -
在Right.vue引用GoodList.vue
查看全部 -
賦值時(shí),使用插值的情況下,不用使用雙大括號(hào),直接使用變量名就可以
查看全部 -
創(chuàng)建動(dòng)態(tài)列表組件 GoodList.vue
template部分
<div?name="show"> ????<ul> ??????????<li?v-for="good?in?list"> ?????????????????<img?v-bind:src="good.img"> ?????????????????<p>{{good.goodName}}</p> ??????????</li> ????</ul> </div>
script部分
export?default{ ???name:"show", ???data(){ ??????var?obj?=?this; ??????this.$http.get("json/bjb.json").then(function(res){ ??????????obj.list?=?res.data;??? ??????}) ??????return{ ??????????list:[]//這個(gè)return的原理是? ??????} ???} }
查看全部 -
npm在本地文件夾安裝完axios之后
在main.js中全局引入 axios
import axios from 'axios'
全局注冊(cè)axios變量
Vue.prototype.$http = axios
查看全部 -
數(shù)據(jù)傳遞接收,先載入 總線,在template總添加變量,在輸入export中的mounted定義接受函數(shù)Msg.$on
$emit 和 $on是一對(duì)
查看全部 -
引用 事件總線 創(chuàng)建事件的$emit函數(shù)
相當(dāng)于信號(hào)發(fā)射
import?Msg?from?'./Msg.vue' export?default{ ?????methods:{ ????????menu1:funciton(){ ????????????Msg.$emit("val","1") ????????}, ????????menu1:funciton(){ ????????????Msg.$emit("val","1") ????????}????? ?????} }
查看全部 -
template里創(chuàng)建促發(fā)事件
@click="menu1"
@click="menu2"
查看全部 -
創(chuàng)建“事件總線”
components下創(chuàng)建一個(gè)msg.vue
import Vue from 'vue'
export default new vue
公共使用
查看全部 -
vue傳值的三種方式:父--子;子--父;非父子;
事件總線???
查看全部 -
組件的復(fù)用
查看全部 -
view引入components中的組件
import? Left from '../components/Left.vue'
export default{//注冊(cè)組件
? ? ? ?? components:{
? ? ? ?? left
? ? }
}
查看全部 -
完整案例主要使用技術(shù)
查看全部
舉報(bào)