如何在Angular 9中使用Browser-Update.org?

问题描述

如果不支持用户的浏览器,我想使用Browser.org's快餐栏来显示提示

Browser.org的文档说该脚本应该集成到index.html中(在结束body标记之前)。如果以这种方式进行操作,它将按预期工作。所以在index.html中,它看起来像这样:

<script>
import PackComponent from '@/components/PackComponent.vue'
import axios from 'axios'

export default {
  name: 'Pricing',components: {
    PackComponent
  },created() {
    axios
      .get('http://localhost:3000/pack')
      .then(response => {
        console.log(response.data.bpi)
      })
      .catch(error => {
        consol.log('There was an error:' + error.response)
      })
  }
}
</script>

但是,我对在index.html中包含某些内容并不满意,而是尝试将其包含在 <script> var $buoop = {required:{e:-4,f:-3,o:-3,s:-1,c:-3},insecure:true,api:2020.10 }; function $buo_f(){ var e = document.createElement("script"); e.src = "//browser-update.org/update.min.js"; document.body.appendChild(e); }; try {document.addEventListener("DOMContentLoaded",$buo_f,false)} catch(e){window.attachEvent("onload",$buo_f)} </script> 中并重写。不幸的是,我的方法行不通:

app.component.ts

app.component.ts

我做错了什么,或者有人已经对此有经验并可以提供帮助?也许有一种方法可以在Typescript或“ The Angular way”中做到这一点?我也不确定我的代码是否已正确重写并有意义。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)