传值:
组件:
@Component({
props: {
photoLists: {}
}
})
调用组件:
.ts
private photoLists = [];
.vue
<photograph showAlbum="false" :photoLists="photoLists"></photograph>
调用函数:
.vue
<div class="photoDiv">
<span class="icon iconfont icon-uploadphoto camera" @click="showPopup"></span>
<photograph showAlbum="false" ref="photograph"></photograph> // 组件
</div>
.ts
private showPopup() {
(this as any).$refs.photograph.showType(); // showType是photograph中的函数
}