2021-10-22 18:51:49 +08:00
|
|
|
<template>
|
|
|
|
<a
|
|
|
|
class="one-edit-link"
|
2021-10-25 20:18:05 +08:00
|
|
|
:class="
|
|
|
|
variant
|
|
|
|
? {
|
|
|
|
[`one-edit-link-${variant}`]: true,
|
|
|
|
}
|
|
|
|
: {}
|
|
|
|
"
|
2021-10-22 18:51:49 +08:00
|
|
|
:href="href"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener"
|
|
|
|
>
|
2021-10-25 20:18:05 +08:00
|
|
|
<slot :label="t('editOnGitHub')">
|
2021-10-28 15:30:35 +08:00
|
|
|
<span class="full">{{ t('editOnGitHub') }}</span>
|
|
|
|
<span class="short">{{ t('edit') }}</span>
|
2021-10-25 20:18:05 +08:00
|
|
|
<veui-icon
|
|
|
|
class="icon"
|
|
|
|
name="external-link"
|
|
|
|
/>
|
|
|
|
</slot>
|
2021-10-22 18:51:49 +08:00
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { Icon } from 'veui'
|
|
|
|
import i18n from 'veui/mixins/i18n'
|
|
|
|
import 'veui-theme-dls-icons/external-link'
|
|
|
|
|
|
|
|
const BASE_URL = 'https://github.com/ecomfe/veui-docs/edit/master/one/docs/'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'one-edit-link',
|
|
|
|
components: {
|
|
|
|
'veui-icon': Icon
|
|
|
|
},
|
|
|
|
mixins: [i18n],
|
|
|
|
props: {
|
2021-10-25 20:18:05 +08:00
|
|
|
variant: {
|
|
|
|
type: String,
|
|
|
|
default: 'default'
|
|
|
|
},
|
2021-10-22 18:51:49 +08:00
|
|
|
path: String
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
href () {
|
|
|
|
return `${BASE_URL}${this.path}`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.one-edit-link
|
2021-10-28 15:30:35 +08:00
|
|
|
display inline-flex
|
|
|
|
align-items center
|
2021-10-22 18:51:49 +08:00
|
|
|
text-decoration none
|
2021-10-25 20:18:05 +08:00
|
|
|
transition background 0.2s, color 0.2s, border-color 0.2s
|
|
|
|
|
2021-10-28 15:30:35 +08:00
|
|
|
.icon
|
|
|
|
margin-left 4px
|
|
|
|
|
2021-10-25 20:18:05 +08:00
|
|
|
&-default
|
|
|
|
display inline-flex
|
|
|
|
align-items center
|
|
|
|
padding 4px 6px
|
|
|
|
border-radius 4px
|
|
|
|
background-color #fff
|
|
|
|
color #848b99
|
|
|
|
border 1px solid #e2e6f0
|
|
|
|
|
|
|
|
&:hover
|
|
|
|
&[data-focus-visible-added]
|
|
|
|
background-color #f6f7fa
|
|
|
|
color #282c33
|
|
|
|
border-color #d3d9e6
|
|
|
|
|
|
|
|
&:active
|
|
|
|
background-color #e2e6f0
|
|
|
|
color #000
|
|
|
|
border-color #d3d9e6
|
|
|
|
|
|
|
|
&-quiet
|
2021-10-22 18:51:49 +08:00
|
|
|
color #282c33
|
|
|
|
|
2021-10-25 20:18:05 +08:00
|
|
|
&:hover
|
|
|
|
&[data-focus-visible-added]
|
|
|
|
color #545b66
|
2021-10-22 18:51:49 +08:00
|
|
|
|
2021-10-25 20:18:05 +08:00
|
|
|
&:active
|
|
|
|
color #000
|
2021-10-28 15:30:35 +08:00
|
|
|
|
2021-10-29 17:13:40 +08:00
|
|
|
.full
|
2021-10-28 15:30:35 +08:00
|
|
|
display inline
|
2021-11-22 15:57:07 +08:00
|
|
|
|
|
|
|
.short
|
|
|
|
display none
|
2021-10-28 15:30:35 +08:00
|
|
|
|
|
|
|
@media (max-width 480px)
|
|
|
|
.one-edit-link-quiet
|
|
|
|
.full
|
|
|
|
display none
|
|
|
|
.short
|
|
|
|
display inline
|
2021-10-22 18:51:49 +08:00
|
|
|
</style>
|