Skip to content

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

Description

@GArosy

问题

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

解决

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

if (!this.value) {
    return
}

位置

function displayMatches() {

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions