-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
620 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { request } from "@/utils/axios"; | ||
|
||
export const getSearchHot = () => request.get('/search/hot') | ||
|
||
export const getSearchSuggest = (keywords) => request.get('/search/suggest', {params: { keywords } }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<template> | ||
<div | ||
@click="onClick" | ||
class="n-button" | ||
> | ||
<slot></slot> | ||
</div> | ||
</template> | ||
|
||
<script type="text/ecmascript-6"> | ||
export default { | ||
methods: { | ||
onClick(e) { | ||
this.$emit('click', e) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.n-button { | ||
display: inline-block; | ||
padding: 5px 16px; | ||
border: 1px solid var(--button-border-color); | ||
border-radius: 2px; | ||
cursor: pointer; | ||
&:hover { | ||
background: var(--button-hover-bgcolor); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<template> | ||
<div> | ||
<slot></slot> | ||
</div> | ||
</template> | ||
|
||
<script type="text/ecmascript-6"> | ||
import { hasParent } from '@/utils/dom' | ||
export default { | ||
props: { | ||
show: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
reserveDoms: { | ||
type: Array | ||
} | ||
}, | ||
methods: { | ||
clickEvent(e) { | ||
const triggerElement = e.target | ||
// 触发点击事件的dom是否是playlist的子节点 | ||
const firstChildElm = this.$slots.default[0].elm | ||
if (!hasParent( | ||
triggerElement, | ||
this.reserveDoms | ||
? this.reserveDoms.concat(firstChildElm) | ||
: firstChildElm | ||
)) { | ||
this.$emit('clickOutside') | ||
} | ||
}, | ||
bindClick() { | ||
document.addEventListener('mousedown', this.clickEvent) | ||
}, | ||
removeClick() { | ||
document.removeEventListener('mousedown', this.clickEvent) | ||
}, | ||
}, | ||
watch: { | ||
show(newShow) { | ||
setTimeout(() => { | ||
if (newShow) { | ||
this.bindClick() | ||
} else { | ||
this.removeClick() | ||
} | ||
}, 0); | ||
} | ||
}, | ||
beforeDestroy() { | ||
this.removeClick() | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.