收藏
回答

组件显示与隐藏事件?

这种方式引入的组件页面,有没有办法获得组件的show、hide事件(用于触发函数来开启和关闭数据实时推送)。


<support wx:if="{{currentPage=='support'}}">support>
<me wx:if="{{currentPage=='me'}}">me>
<notice wx:if="{{currentPage=='notice'}}">notice>


我看了一下文档,组件只有attached、detached两个生命周期,并没有show、hide。

我希望的是当页面为support页是,触发support.js中的funWatcher(),反之,触发funClose()


完整WXML:


<view class="page" data-weui-theme="light">



<view class="fixed width z-index-600">
	<view style="height:{{CustomBar}}px;" class="width shadow bg-white">
		<view class="flex align-center justify-start text-center width relative" style="padding-top:{{StatusBar}}px;height:{{ContentBar}}px">
			<view class="navigationCenter">
				<image style="width:60px;height:25px;" mode="heightFix" src="/images/logoBlack.png">image>
			view>
		view>
	view>
view>



<view style="height:{{CustomBar}}px;width:100%;">view>



<support wx:if="{{currentPage=='support'}}">support>
<me wx:if="{{currentPage=='me'}}">me>
<notice wx:if="{{currentPage=='notice'}}">notice>



<view class="footerBar">
	<view>


		<view class="{{currentPage=='support'?'text-green':'text-grey'}} text-xxl" hover-class="btn-hover" bindtap="bindPageChange" data-target="support">
			<view class="cuIcon-friend margin-bottom-xs">view>
			<view class="text-sm">支撑view>
		view>


		<view class="text-grey text-xxxl bar-center" bindtap="bindPageChange" data-target="notice">
			<view>
				<view class="cuIcon-notice bg-green" hover-class="btn-hover">view>
			view>
			<view class="text-sm">通知view>
		view>


		<view class="{{currentPage=='me'?'text-green':'text-grey'}} text-xxl" hover-class="btn-hover" bindtap="bindPageChange" data-target="me">
			<view class="cuIcon-people margin-bottom-xs">view>
			<view class="text-sm">我的view>
		view>


	view>
view>
view>










回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签