text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d2227a4"],{cf7b:function(n,t,e){"use strict";e.r(t);var a=function(){var n=this,t=n.$createElement,e=n._self._c||t;return e("div",{staticClass:"container"},[e("Parent")],1)},r=[],c=function(){var n=this,t=n.$createElement,e=n._self._c||t;return e("div",{staticClass:"container"},[e("h2",[n._v("父子组件通信方式4:provide和inject")]),e("Child"),e("button",{on:{click:n.add}},[n._v("添加一条数据，看看是否是响应式")])],1)},i=[],s=function(){var n=this,t=n.$createElement,e=n._self._c||t;return e("div",{staticClass:"container"},[e("ul",n._l(this.parent.array,(function(t,a){return e("li",{key:t},[n._v(" "+n._s(t)+" "),e("button",{on:{click:function(t){return n.passIndex(a)}}},[n._v("子组件通过inject的方式，传值给父组件")])])})),0)])},o=[],u={name:"Child",created:function(){},inject:{parent:{default:function(){return{}}}},methods:{passIndex:function(n){this.parent.getIndex(n)}}},l=u,d=e("2877"),f=Object(d["a"])(l,s,o,!1,null,"4dd77bdf",null),h=f.exports,p=e("2b0e"),v={name:"Parent",components:{Child:h},created:function(){},provide:function(){var n=p["a"].observable({array:this.array,getIndex:this.getIndex,vm:this});return{parent:n}},data:function(){return{array:["我是父组件传递的值1","我是父组件传递的值2"]}},methods:{getIndex:function(n){alert("这是子组件传过来的下标：".concat(n))},add:function(){this.array.push("我是父组件传递的值".concat(this.array.length+1))}}},b=v,_=Object(d["a"])(b,c,i,!1,null,"658a684b",null),m=_.exports,x={name:"ViewD",components:{Parent:m}},w=x,y=Object(d["a"])(w,a,r,!1,null,"e138ea36",null);t["default"]=y.exports}}]);