暂存
This commit is contained in:
parent
065df5cc9e
commit
1a7e373aa1
@ -46,6 +46,7 @@ export function Avatar(options) {
|
||||
}
|
||||
|
||||
export function UploadMusic(options) {
|
||||
let dragStats = null
|
||||
const drop = createElement({
|
||||
textContent: '点击或拖拽音乐到此处共享您的音乐',
|
||||
style: {
|
||||
@ -95,14 +96,24 @@ export function UploadMusic(options) {
|
||||
onmouseleave: event => {
|
||||
drop.style.display = 'none'
|
||||
},
|
||||
// 如果拖拽到了子元素上, 也要触发父元素的事件
|
||||
ondragover: event => {
|
||||
console.log('dragover')
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
if(dragStats) return
|
||||
event.dataTransfer.dropEffect = 'copy'
|
||||
drop.style.display = 'block'
|
||||
},
|
||||
ondragleave: event => {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
if(dragStats) return
|
||||
clearTimeout(dragStats)
|
||||
dragStats = setTimeout(() => {
|
||||
drop.style.display = 'none'
|
||||
dragStats = null
|
||||
}, 1000)
|
||||
},
|
||||
ondrop: event => {
|
||||
console.log('drop')
|
||||
event.preventDefault()
|
||||
@ -112,11 +123,6 @@ export function UploadMusic(options) {
|
||||
console.log('files', files)
|
||||
options.onchange(files)
|
||||
},
|
||||
ondragleave: event => {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
drop.style.display = 'none'
|
||||
},
|
||||
children: [
|
||||
// 绘制一个云朵上传图标(别放弃...还有我呢!)
|
||||
createElement({
|
||||
|
Loading…
Reference in New Issue
Block a user