In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to use indexof in vue, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
In vue, indexof () can be used to return the position where a specified string value first appears in the string, or to use the return value to determine whether the specified string exists or not, the syntax "stringObject.indexOf (searchvalue,fromindex)".
The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.
Indexof in vue
The indexOf () method returns the position where a specified string value first appears in the string.
Grammar
StringObject.indexOf (searchvalue,fromindex)
Parameter description
Searchvalue: required. Specifies the string value to retrieve.
Fromindex: optional integer parameter. Specifies where to start the retrieval in the string. Its legal value is 0 to stringObject.length-1. If this parameter is omitted, it will be retrieved from the first character of the string.
Description
This method retrieves the string stringObject from beginning to end to see if it contains the substring searchvalue. The retrieval starts at the fromindex of the string or at the beginning of the string (when no fromindex is specified). If a searchvalue is found, the location where the searchvalue first appeared is returned. The character position in stringObject starts at 0.
Tips and comments
Note: the indexOf () method is case sensitive!
Note: if the string value to be retrieved does not appear, the method returns-1.
Example
How to use indexOf () to retrieve within a string.
If (whiteList.indexOf (to.path)! =-1) {undefined// is in the login-free whitelist, go directly to next ()} else {undefinednext (`/ login?redirect=$ {undefinedto.path}`) / / otherwise redirect to the login page NProgress.done ()}} above is all the content of this article "how to use indexof in vue". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.