This commit is contained in:
shijingjing
2023-02-13 08:41:14 +08:00
parent 88d29e99f2
commit 06ac9ae4fd
2 changed files with 19 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
<template>
<div class="classDetail">
<div class="media">
<img src="./img/bg.png" alt="">
<img src="./img/jige.png" alt="">
<!-- <video src="./img/2676.mp4" controls/> -->
</div>

View File

@@ -140,12 +140,30 @@ 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>