Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

06-Type Ahead 添加一个判断内容是否为空的if #63

Open
GArosy opened this issue Apr 28, 2022 · 0 comments
Open

06-Type Ahead 添加一个判断内容是否为空的if #63

GArosy opened this issue Apr 28, 2022 · 0 comments

Comments

@GArosy
Copy link

GArosy commented Apr 28, 2022

问题

当清空输入框时 searchvalue 为空,此时所有诗句全部符合匹配规则,导致它们全部显示在页面中。

解决

displayMatches 函数开头添加一个判断,如果输入框为空不做处理:

if (!this.value) {
    return
}

位置

function displayMatches() {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant