naive-ui/demo/utils/EditOnGithubButton.vue

55 lines
872 B
Vue
Raw Normal View History

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