naive-ui/demo/utils/EditOnGithubButton.vue
2020-05-30 21:11:46 +08:00

55 lines
857 B
Vue

<template>
<n-button
class="edit-button"
ghost
round
:size="size"
:text="text"
@click="handleEditOnGithubClick"
>
<template v-slot:icon>
<edit-icon />
</template>
</n-button>
</template>
<script>
import editIcon from '../../src/_icons/create-outline'
export default {
name: 'EditOnGithubButton',
components: {
editIcon
},
props: {
url: {
type: String,
required: true
},
text: {
type: Boolean,
default: false
},
size: {
type: String,
default: undefined
}
},
data () {
return {
gheUrl: 'https://***REMOVED***/tree/develop/'
}
},
computed: {
gheDocUrl () {
return this.gheUrl + this.url
}
},
methods: {
handleEditOnGithubClick () {
window.open(this.gheDocUrl, '_blank')
}
}
}
</script>