Skip to content

Commit

Permalink
fix: add as prop to vue/angular integrations (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
breadadams committed Feb 21, 2020
1 parent e03d289 commit 873ad9a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
7 changes: 6 additions & 1 deletion packages/angular/src/microlink/microlink.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ export class MicrolinkComponent implements AfterViewInit, OnChanges {
anchor.href = this.url
anchor.innerHTML = this.url

microlink(anchor, this.options, nativeElement)
const options = {
...this.options,
as: 'a'
}

microlink(anchor, options, nativeElement)
}

ngAfterViewInit () {
Expand Down
11 changes: 8 additions & 3 deletions packages/vue/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const Microlink = Vue.component('Microlink', {
const anchor = document.createElement('a')
anchor.href = this.url
anchor.innerHTML = this.url
microlink(anchor, this.parameters, cardSpace)
microlink(anchor, this.options, cardSpace)
}
},

Expand All @@ -41,14 +41,19 @@ export const Microlink = Vue.component('Microlink', {
},

computed: {
parameters () {
return Object.keys(this.$attrs).reduce(
options () {
const opts = Object.keys(this.$attrs).reduce(
(acc, value) =>
value.startsWith('data-')
? acc
: { ...acc, [camelCase(value)]: this.$attrs[value] },
Vue.microlinkGlobalOptions || {}
)

return {
...opts,
as: 'a'
}
}
},

Expand Down

0 comments on commit 873ad9a

Please sign in to comment.