简体   繁体   English

TabView中的搜索栏的textChange仅触发一次

[英]textChange of searchbar in TabView only triggered once

I have a tab component with a search component. 我有一个带有搜索组件的选项卡组件。 This component exists of a searchbar with textChange-event. 该组件存在于带有textChange-event的搜索栏中。 The event is triggered once when the app is starting and then never again. 该事件在应用程序启动时触发一次,然后不再触发。 Same code works perfectly when not part of the tabview. 当不在tabview中时,相同的代码可以完美地工作。

The tabview (shortened): tabview(缩短):

<TabView id="tabview1" (selectedIndexChanged)="onSelectedIndexChanged($event)">
    <StackLayout *tabItem="{title: 'search' | L, iconSource: getIconSource('search')}">
        <Search></Search>
    </StackLayout>
</TabView>

The search component looks like this: 搜索组件如下所示:

<Page>        
    <StackLayout>
        <SearchBar [text]="searchPhrase" (textChange)="onTextChanged($event)"></SearchBar>
    </StackLayout>
<Page>

onTextChanged() only prints (or rather would print) the new text to the console. onTextChanged()仅将新文本打印(或将要打印)到控制台。

Any idea how to solve this? 任何想法如何解决这个问题?

The problem was the page in my search component. 问题是我的搜索组件中的page After removing it, the event gets triggered as intended. 删除事件后,将按预期触发事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM