Skip to content

Commit

Permalink
fix:
Browse files Browse the repository at this point in the history
  • Loading branch information
L1Yuuu committed Jul 1, 2020
1 parent 3d2cb23 commit 19c4d6d
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
- [performance](https://l1yuu.github.io/frontend-course-list/javascript/performance)
- [postMessage](https://l1yuu.github.io/frontend-course-list/javascript/post-message)
- [regexp](https://l1yuu.github.io/frontend-course-list/javascript/regexp)
(https://l1yuu.github.io/frontend-course-list/javascript/symbol)
- [clipboard](https://l1yuu.github.io/frontend-course-list/javascript/clipboard)
- layout
- [border0.5px](https://l1yuu.github.io/frontend-course-list/layout/border0.5)
- [offsetScrollGuide](https://l1yuu.github.io/frontend-course-list/layout/offset-scroll-guide)
Expand Down
19 changes: 19 additions & 0 deletions javascript/clipboard/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Clipboard</title>
</head>
<body>
<textarea placeholder="paste" rows="3"></textarea>
<div id="log" contenteditable="true"></div>
</body>

<script src="./index.js"></script>
<style>
#log, textarea {
width: 300px;
}
</style>
</html>
35 changes: 35 additions & 0 deletions javascript/clipboard/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* @Author: Blue
* @Date: 2020-07-01 10:21:33
* @Last Modified by: Blue
* @Last Modified time: 2020-07-01 15:25:53
*/

function log(val) {
let chlidren = document.createElement('div');
chlidren.innerHTML = val;
document.querySelector('#log').appendChild(chlidren);
}


document.addEventListener('copy', evnet => {
console.log(evnet);
})
document.querySelector('textarea').addEventListener('paste', evnet => {

let items = event.clipboardData?.items;
if(items && items.length) {
let content = items[items.length - 1];
if(content.type.match('image')) {
log(content.type);
log(`
<img width="100%" src="${ URL.createObjectURL(content.getAsFile()) }" />
`)
} else {
log(content.type);
content.getAsString(function(detail) {
log(detail)
})
}
}
})
6 changes: 4 additions & 2 deletions javascript/vue-computed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: Blue
* @Date: 2020-06-29 15:35:29
* @Last Modified by: Blue
* @Last Modified time: 2020-06-29 15:38:51
* @Last Modified time: 2020-07-01 14:36:28
*/

let Dep = null;
Expand Down Expand Up @@ -46,7 +46,9 @@ let Data = {

defineMonitor(Data, 'a', 'abcd')

Data.a = 'test test';

defineComputed(Data, 'b', function() {
// ....
console.log(this.a + 1);
})

11 changes: 11 additions & 0 deletions native-api/clipboard/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Clipboard</title>
</head>
<body>

</body>
</html>
10 changes: 10 additions & 0 deletions native-api/clipboard/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* @Author: Blue
* @Date: 2020-07-01 15:27:05
* @Last Modified by: Blue
* @Last Modified time: 2020-07-01 15:27:05
*/




0 comments on commit 19c4d6d

Please sign in to comment.