expressgy 1 year ago
parent 837c297b20
commit 7b09db551d
  1. 156
      src/pages/Home/index.jsx

@ -147,5 +147,161 @@ export default function App(){
</div>
</>
}
//
console.log(1)
function a(){
console.log(2)
}
(function autoRun(){
return console.log(3)
})()
setTimeout(() => {
console.log(4)
})
function b(){
return new Promise((resolve, reject) =>{
console.log(5)
new Promise((res) => {
console.log(6)
res(7)
})
resolve(8)
setTimeout(() => {
reject(9)
})
})
}
a()
b().then(
res => {
console.log(res)
},
e => {
console.log(e)
}
)
// this
class A{
constructor() {
this.name = 'haha'
}
one(){
return () => {
console.log(this.name)
}
}
two(){
return function (){
console.log(this?.name)
}
}
}
const aClass = new A()
const one = aClass.one()
const two = aClass.two()
one()
two()
// two.call(aClass)
//
// name
//
let num1 = 99, num2 = 98;
const str1 = 'World', str2 = 'Hello';
[num1, num2] = [num2, num1];
// [str1, str2] = [str2, str1];
console.log(num1, num2);
console.log(str1, str2);
//
const list1 = [1,2,3,4,5];
const list2 = [6,7,8,9,10];
let list = [];
// list1list2
// 1 list = [...list, ...list2]
// 2 list = list1.concat(list2)
// list
// list.sort((x,y)=> x - y)
//
let arrNum = [1,1,3,4,4,9,1,4,6,8]
// console.log(Array.from(new Set(arrNum)));
//
function autoRun(){
let name = 'Nier'
let people = {
age: 24,
sex: 1,
birthday: `991332`
}
function makeNewPeople(name, people){
people.name = name
name = 'Anto'
console.log(name, people)
}
console.log(name, people)
makeNewPeople(name, people)
console.log(name, people)
}
autoRun()
//
function autoRun2(){
const CP1 = {
cpu: 'i9 13900k',
mem: '32GB 7600MHz DDR5',
videoCard: 'RTX 4090'
}
const CP2 = {
cpu: 'i5 8250U',
mem: '8GB 3200MHz DDR4',
videoCard: 'GTX 1050 MaxQ'
}
// CP1CP2
// const CP = {...CP1, ...CP2}
const CPList = [CP1, CP2]
// CP1CPList
}
//
function autoRun3(){
const resd = [
{ id: 32, name: 'a', fatherId: 0 },
{ id: 16, name:'b', fatherId: 32 },
{ id: 8, name: 'c', fatherId: 4 },
{ id: 7, name: 'c', fatherId: 8 },
{ id: 6, name: 'c', fatherId: 4 },
{ id: 5, name: 'c', fatherId: 4 },
{ id: 4, name: 'c', fatherId: 1 },
{ id: 3, name: 'c', fatherId: 16 },
{ id: 2, name: 'c', fatherId: 5 },
{ id: 1, name: 'c', fatherId: 0 }
]
}
// resd
// sessionStoragelocalStorageAB sessionStorage
function autoRun5(){
window.location.href = "http://www.baidu.com";
window.history.go(-1);
window.open('page.html');
this.$router.push('/goods/add')
// <router-link to="/goods/add"></router-link>
this.$router.replace({path:'/goods/add'});
this.$router.go(-1)
}

Loading…
Cancel
Save