naive-ui/demo/utils/EditOnGithubButton.vue
2021-06-02 17:51:13 +08:00

37 lines
650 B
Vue

<template>
<n-button class="edit-button" text :size="size" @click="handleClick">
<template #icon>
<n-icon>
<edit-icon />
</n-icon>
</template>
</n-button>
</template>
<script>
import EditIcon from '@vicons/fluent/Compose16Regular.js'
import githubUrl from './github-url'
export default {
name: 'EditOnGithubButton',
components: {
EditIcon
},
props: {
relativeUrl: {
type: String,
required: true
},
text: Boolean,
size: String
},
setup (props) {
return {
handleClick () {
window.open(githubUrl + props.relativeUrl, '_blank')
}
}
}
}
</script>