Skip to content

Commit

Permalink
Add "as" link option to Vue 3 adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
reinink committed Oct 19, 2020
1 parent aa5bf42 commit f9aafe0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/inertia-vue3/src/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { hrefToUrl, Inertia, mergeDataIntoQueryString, shouldIntercept } from '@

export default {
props: {
as: {
type: String,
default: 'a',
},
data: {
type: Object,
default: () => ({}),
Expand Down Expand Up @@ -44,9 +48,9 @@ export default {
props.data,
)

return h('a', {
return h(props.as, {
...attrs,
href: url.href,
...props.as === 'a' ? { href: url.href } : {},
onClick: (event) => {
if (shouldIntercept(event)) {
event.preventDefault()
Expand Down

0 comments on commit f9aafe0

Please sign in to comment.