logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

hashtag_link.js (687B)


  1. import { extractTagFromUrl } from 'src/services/matcher/matcher.service.js'
  2. const HashtagLink = {
  3. name: 'HashtagLink',
  4. props: {
  5. url: {
  6. required: true,
  7. type: String
  8. },
  9. content: {
  10. required: true,
  11. type: String
  12. },
  13. tag: {
  14. required: false,
  15. type: String,
  16. default: ''
  17. }
  18. },
  19. methods: {
  20. onClick () {
  21. const tag = this.tag || extractTagFromUrl(this.url)
  22. if (tag) {
  23. const link = this.generateTagLink(tag)
  24. this.$router.push(link)
  25. } else {
  26. window.open(this.url, '_blank')
  27. }
  28. },
  29. generateTagLink (tag) {
  30. return `/tag/${tag}`
  31. }
  32. }
  33. }
  34. export default HashtagLink