[js]vue顯示一個外部鏈接的組件

顯示一個外部鏈接的組件

<template>
  <component :is="type" v-bind="linkProps(to)">
    213123123123
  </component>
</template>

<script>

export default {

  data() {
    return {
      type: 'a',
      to: "https://www.qq.com"
    }
  },
  methods: {
    linkProps(to) {
      return {
        href: to,
        target: '_blank',
        rel: 'noopener'
      }
      return {
        to: to
      }
    }
  }
}
</script>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章