naive-ui/demo/utils/EditOnGithubButton.vue

48 lines
796 B
Vue
Raw Normal View History

2020-03-19 13:26:06 +08:00
<template>
<n-button
class="edit-button"
ghost
round
@click="handleEditOnGithubClick"
>
<template v-slot:icon>
<create-outline />
</template>
</n-button>
</template>
<script>
import createOutline from '../../src/_icons/create-outline'
export default {
name: 'EditOnGithubButton',
components: {
createOutline
},
props: {
url: {
type: String,
required: true
}
},
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>
<style lang="scss" scoped>
.edit-button {
vertical-align: middle;
}
</style>