Home > Web Front-end > JS Tutorial > Operate the search component to display on the keyboard

Operate the search component to display on the keyboard

php中世界最好的语言
Release: 2018-04-16 11:14:11
Original
1720 people have browsed it

This time I will bring you the precautions for operating the search component to display on the keyboard. The following is a practical case. Let’s take a look.

The code is as follows:

<form action="" target="frameFile">
 <mt-search v-model="value" placeholder="请输入关键字" @keyup.native.enter="search(value)">
 <p v-infinite-scroll="loadMore()" infinite-scroll-disabled="loading" infinite-scroll-distance="10">
  <ListItem :lists="lists"></ListItem>
  <p class="loading-text" v-if="(loadingTextBtn==true)"><span v-text="loadingText"></span><mt-spinner v-if="(loadingComplete==false)" type="snake" :size="10"></mt-spinner></p>
 </p>
 </mt-search>
 <iframe name=&#39;frameFile&#39; style="display: none;"></iframe>
</form>
Copy after login

Solution:

The input of the search component of mint-ui is also of type="search" by default, but it also needs to be wrapped with a set of form tags in the outer layer and with actions, so that the search button will appear in the keyboard.

The above is method one:

When you click search on the mobile keyboard, the page will refresh, so add a target to the form. The target specifies where to open the action URL. Then put a hidden iframe and name the value of the target of the form, so that on the current page Display the search content

The following is method two:

<form action="" onsubmit="return false;">
  <mt-search v-model="value" placeholder="请输入关键字" @keyup.native.enter="search(value)">
   <p v-infinite-scroll="loadMore()" infinite-scroll-disabled="loading" infinite-scroll-distance="10">
   <ListItem :lists="lists"></ListItem>
   <p class="loading-text" v-if="(loadingTextBtn==true)"><span v-text="loadingText"></span><mt-spinner v-if="(loadingComplete==false)" type="snake" :size="10"></mt-spinner></p>
   </p>
  </mt-search>
</form>
Copy after login

Here, write return false directly to onsubmitevent to disable submission, and the search list page can also be displayed on the current page.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:



The above is the detailed content of Operate the search component to display on the keyboard. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template