• 赚钱入口【需求资源】限时招募流量主、渠道主,站长合作;【合作模式】CPS长期分成,一次推广永久有收益。主动打款,不扣量;

vuejs组件引入外部js代码

Vue cps12345 2个月前 (11-10) 169次浏览 15个评论

vuejs组件如何引入外部js代码?

解决

在组件的mounted()方法中加载外部js代码

<template>
   .... your HTML
</template>

<script>
  export default {
    data: () => ({
      ......data of your component
    }),
    mounted() {
      let recaptchaScript = document.createElement('script')
      recaptchaScript.setAttribute('src', 'https://www.google.com/recaptcha/api.js')
      document.head.appendChild(recaptchaScript)
    },
    methods: {
      ......methods of your component
    }
  }
</script>

 

喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(15)个小伙伴在吐槽
  1. If you want to use the photo it would also be good to check with the artist beforehand in case it is subject to copyright. Best wishes. Aaren Reggis Sela
    erotik izle2020-11-13 13:13 回复
  2. I take pleasure in, cause I found just what I was having a look for. Georgia Yule Mella
    erotik izle2020-11-14 03:49 回复
  3. Extraordinarily significant data you have said, thank you for putting up. Leonanie Feodor Liliane
    porno2020-11-14 14:03 回复
  4. Fantastic article post. Really looking forward to read more. Rois Brewer Canute
    sikis izle2020-11-15 01:44 回复
  5. I enjoy reading and I conceive this website got some truly utilitarian stuff on it! . Missie Granville Virgie
    erotik2020-11-15 08:43 回复
  6. Spot on with this write-up, I really assume this website needs rather more consideration. I all most likely be again to learn rather more, thanks for that info. Hiroko Quercia
    yerli filmler2020-12-11 19:50 回复
  7. wonderful points altogether, you just won a brand new reader. What would you suggest about your post that you just made some days ago? Any positive?
    Mikko2020-12-12 02:58 回复
  8. With every thing which appears to be developing inside this particular area, many of your points of view tend to be fairly stimulating. Nevertheless, I appologize, but I do not give credence to your entire strategy, all be it exciting none the less. It seems to everybody that your opinions are not totally validated and in fact you are generally yourself not fully convinced of your point. In any event I did take pleasure in examining it. Ernesto Delvin
  9. “Thanks for sharing, this is a fantastic article post.Really thank you! Really Great.” Frank Servino
    film izle 20202020-12-18 11:17 回复
  10. You produce quality content, I appreciate you
    davis dreyfus2021-01-01 11:47 回复
  11. I reckon something truly special in this website.
    chwilówki2021-01-03 10:58 回复
  12. Really nice design and good subject material. Please also check my website. I love cars!
  13. Really nice design and good subject material. Please also check my website. I love cars!
  14. Thanks so much for the blog post.Thanks Again. Great.
    coreen outten2021-01-04 19:40 回复
  15. Do you want to hit the jackpot in your SEO efforts? this online marketing offer is for you. I offer you the most advance and safe link building method thrive to your site top SERPS and traffic to your Website or Video.
    estetika2021-01-06 07:21 回复