Component 里有个bindinput提示在parent index页面没有找到?
发布于 6 年前 作者 yanxiulan 8662 次浏览 来自 问答

我在pages/index/index下面用了一个Component,而这个Component里面有个input并且设置bindinput=“searchInput”。在这个Component的js文件里,我已经定义了这个searchInput方法。模拟器没有问题,但是真机运行提示pages/index/index里面没有定义这个searchInput。关键是这个是在Component里的。难道每个在Component里bind了还要在它的parent页面又要bind一次?

/pages/index/index.wxml
 
<discover></discover>
 
/pages/discover/home/home.wxml
 
<input type="text" bindinput="searchInput"></input>
 
/pages/discover/home/home.js
 
methods: {
    searchInput(e) {
        this.setData({
            query: e.detail.value
        })
 
    },
}

3 回复

我不管3721,在pages/index/index加了这个searchInput提示消失了,但是bindtap点击居然没效果。哎

没代码片段 我猜不出来

代码片段

回到顶部