居民认证

This commit is contained in:
shijingjing
2023-02-13 14:14:51 +08:00
parent 06ac9ae4fd
commit 825ae8e41b
2 changed files with 48 additions and 24 deletions

View File

@@ -140,30 +140,12 @@ export default {
confirm() {
uni.navigateTo({url: './result'})
},
/*
给定一个字符串 s ,找到 它的第一个不重复的字符,并返回它的索引 。如果不存在,则返回 -1 。
s = "leetcode" . => 0
s = "loveleetcode" => 2
*/
firstUniqChar(str) {
for(let i=0; i<=str.length; i++) {
// let sum = 0;
for(let x=0;x<str.length;x++) {
if(str[i] === str[x] && i!=x) {
console.log(i);
}
}
}
// return -1
}
},
onReachBottom() {
this.current ++;
},
onLoad() {
// this.createdTime = Date.parse(new Date())
this.firstUniqChar('leetcode')
}
}
</script>