父组件代码
<template>
<scroll class="listview"
ref="list"
:listen-scroll="listenScroll"
:probe-type="probeType">
<div>
···
</div>
</scroll>
</template>
<script>
import Scroll from 'base/scroll/scroll'
export default {
created(){
this.listenScroll = true,
this.probeType=3
},
components:{
Scroll
}
}
</script>
子组件代码
<template>
<div ref="wrapper">
<slot></slot>
</div>
</template>
<script type="text/ecmascript-6">
import BScroll from 'better-scroll'
export default {
porps:{
probeType:{
type:Number,
default:1
},
click:{
type:Boolean,
default:true
},
data:{
type:Array,
default:null
},
listenScroll:{
type:Boolean,
default:false
}
},
mounted(){
setTimeout(()=>{
this._initScroll()
},20)
},
methods:{
_initScroll(){
if(!this.$refs.wrapper){
return
}
this.scroll = new BScroll(this.$refs.wrapper,{
probeType:this.probeType,
click:this.click
})
console.log(this.scroll)
console.log(this.listenScroll,'listenScroll')
//下文有console出来的结果
}
}
}
控制台console出来的结果是:
麻烦各位大佬帮忙看看,是不是时机的问题?
因为父组件再怎么不把值传给子组件,子组件的props是有default的,不应该是undefined啊...
如果要改的话怎么改比较好? 先谢过啦!~~
porps
!?