Skip to content

Commit

Permalink
create
Browse files Browse the repository at this point in the history
  • Loading branch information
abstain23 committed Jun 1, 2020
1 parent 37b556c commit 1fb24d6
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
34 changes: 34 additions & 0 deletions better-scroll/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://unpkg.com/better-scroll/dist/bscroll.min.js"></script>
<style>
.wrapper{
background: #fff;
height: 100vh;
width:375px;
overflow: hidden;
background:#fff;
/* margin-bottom:15px; */
}
img {
width: auto;
height: 100%;
}
</style>
</head>
<body>
<div class="wrapper" id="tab">
<img src="./long.png" alt="">
</div>
<script>
new BScroll(document.getElementById('tab'), {
scrollX:true,
// eventPassthrough: 'vertical'
})
</script>
</body>
</html>
Binary file added better-scroll/long.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<title>Document</title>
</head>
<body>
<script src="./promise2.js"></script>
<script src="./手写create.js"></script>
</body>
</html>
27 changes: 27 additions & 0 deletions 手写create.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// function A() {
// this.name = 'a'
// }

// let a = Object.create(A)
// console.log(a)

function create(proto) {
const F = function () {}
F.prototype = {...proto}
// F.prototype.constructor = proto.constructor
return new F()
// let obj = {}
// obj.__proto__ = proto
// // obj.constructor = proto.constructor
// return obj
}

let obj = {a:1}
console.log(create(obj))

function Person() {
this.name = 'person'
}
let p = new Person()
console.log(create(p))
console.log(Object.create(p))

0 comments on commit 1fb24d6

Please sign in to comment.