源码按钮
Former-commit-id: 4d1b3a8887b907db7555bfe53648ed762dba9892 [formerly 4d1b3a8887b907db7555bfe53648ed762dba9892 [formerly 4d1b3a8887b907db7555bfe53648ed762dba9892 [formerly 4d1b3a8887b907db7555bfe53648ed762dba9892 [formerly 2ef0e6fdbf2fc0116fb75086242315f3dbec48ea [formerly 58a909b244521701be296255b19109ede6f6e026]]]]] Former-commit-id: ee181b29e947f0b153e512b4c52abfe9d76be811 Former-commit-id: da0acd29407fc35750d0c35a3d081de33323a5db Former-commit-id: e2767964b4b6a721a459b8a86850c7b2d4629436 [formerly 3b3395ce0f85d801a459e6d4ab85c5ddf074e1ea] Former-commit-id: db2f2c5ee8fc19e139213b6b0defd8a7668c8e58 Former-commit-id: 6ec66b8e7d1463e2538d6adb6df716220859e307 Former-commit-id: 3f4f38e1932f4e974246e2247562c18c8bc4777d Former-commit-id: 52522c2f656af093164cee9c3cbce4310bced354 Former-commit-id: 2b80d11df99ae511dfc7155e33837fae2f0ded2e
This commit is contained in:
@@ -1,9 +1,45 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="d2-source">
|
<div
|
||||||
|
class="d2-source"
|
||||||
|
:class="{ 'd2-source--active': isActive }"
|
||||||
|
@click="handleClick">
|
||||||
<d2-icon name="code"/> SourceCode
|
<d2-icon name="code"/> SourceCode
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
// 文件路径
|
||||||
|
filename: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
isActive: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
// 一秒后显示按钮
|
||||||
|
setTimeout(() => {
|
||||||
|
this.isActive = true
|
||||||
|
}, 1000)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 点击按钮的时候跳转到源代码
|
||||||
|
handleClick () {
|
||||||
|
const file = this.filename.split('?')[0]
|
||||||
|
const url = file
|
||||||
|
? `https://github.com/d2-projects/d2-admin/blob/master/${file}`
|
||||||
|
: 'https://github.com/d2-projects/d2-admin'
|
||||||
|
this.$open(url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import '~@/assets/style/public.scss';
|
@import '~@/assets/style/public.scss';
|
||||||
.d2-source {
|
.d2-source {
|
||||||
@@ -11,8 +47,10 @@
|
|||||||
$paddingLR: 15px;
|
$paddingLR: 15px;
|
||||||
$paddingTB: 7px;
|
$paddingTB: 7px;
|
||||||
$fontSize: 12px;
|
$fontSize: 12px;
|
||||||
|
$rightOuter: $paddingLR / 2;
|
||||||
|
opacity: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: - $borderRadius;
|
right: - $borderRadius - $rightOuter;
|
||||||
bottom: 20px;
|
bottom: 20px;
|
||||||
font-size: $fontSize;
|
font-size: $fontSize;
|
||||||
line-height: $fontSize;
|
line-height: $fontSize;
|
||||||
@@ -25,7 +63,11 @@
|
|||||||
color: #FFF;
|
color: #FFF;
|
||||||
transition: all .3s;
|
transition: all .3s;
|
||||||
@extend %unable-select;
|
@extend %unable-select;
|
||||||
|
&.d2-source--active {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
&:hover {
|
&:hover {
|
||||||
|
right: - $borderRadius;
|
||||||
background-color: rgba(#000, .9);
|
background-color: rgba(#000, .9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,9 @@ export default {
|
|||||||
scroll: e => this.$emit('scroll', e)
|
scroll: e => this.$emit('scroll', e)
|
||||||
}
|
}
|
||||||
}, slots),
|
}, slots),
|
||||||
h(d2Source)
|
h(d2Source, {
|
||||||
|
props: this.$attrs
|
||||||
|
})
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<d2-container class="page">
|
<d2-container
|
||||||
|
class="page"
|
||||||
|
:filename="filename">
|
||||||
<d2-page-cover
|
<d2-page-cover
|
||||||
:title="`D2 Admin ${version}`"
|
:title="`D2 Admin ${version}`"
|
||||||
sub-title="优雅的中后台集成方案">
|
sub-title="优雅的中后台集成方案">
|
||||||
@@ -43,6 +45,11 @@ export default {
|
|||||||
D2HelpBtn,
|
D2HelpBtn,
|
||||||
D2Badge
|
D2Badge
|
||||||
},
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
filename: __filename
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState('d2admin/releases', [
|
...mapState('d2admin/releases', [
|
||||||
'version'
|
'version'
|
||||||
|
|||||||
Reference in New Issue
Block a user