naive-ui/demo/utils/EditOnGithubButton.vue

44 lines
707 B
Vue
Raw Normal View History

2020-03-19 13:26:06 +08:00
<template>
2021-06-02 18:29:54 +08:00
<n-button
class="edit-button"
text
:size="size"
@click="handleClick"
:depth="depth"
>
2020-11-03 15:10:29 +08:00
<template #icon>
<n-icon>
<edit-icon />
</n-icon>
2020-03-19 13:26:06 +08:00
</template>
</n-button>
</template>
2020-03-19 18:26:48 +08:00
2020-03-19 13:26:06 +08:00
<script>
import EditIcon from '@vicons/fluent/Compose16Regular.js'
2021-06-05 04:20:31 +08:00
import { treeUrl } from './github-url'
2020-03-19 18:26:48 +08:00
2020-03-19 13:26:06 +08:00
export default {
name: 'EditOnGithubButton',
components: {
2020-11-03 18:56:13 +08:00
EditIcon
2020-03-19 13:26:06 +08:00
},
props: {
2020-09-04 01:06:39 +08:00
relativeUrl: {
2020-03-19 13:26:06 +08:00
type: String,
required: true
2020-03-19 18:26:48 +08:00
},
2021-06-02 17:51:13 +08:00
text: Boolean,
2021-06-02 18:29:54 +08:00
size: String,
depth: String
2020-03-19 13:26:06 +08:00
},
2021-06-02 17:51:13 +08:00
setup (props) {
2020-03-19 13:26:06 +08:00
return {
2021-06-02 17:51:13 +08:00
handleClick () {
2021-06-05 04:20:31 +08:00
window.open(treeUrl + props.relativeUrl, '_blank')
2021-06-02 17:51:13 +08:00
}
2020-03-19 13:26:06 +08:00
}
}
}
</script>