VUE单页面引入JS文件

<template>
  <div id="baseReport" >
  <remote-css href="https://cdn.bootcss.com/twitter-bootstrap/4.2.1/css/bootstrap-grid.min.css"></remote-css>
  <remote-css href="https://cdn.bootcss.com/twitter-bootstrap/4.2.1/css/bootstrap-reboot.css"></remote-css>
  <remote-css href="https://cdn.bootcss.com/twitter-bootstrap/4.2.1/css/bootstrap.css"></remote-css>
  <remote-js src="https://cdn.bootcss.com/twitter-bootstrap/4.2.1/js/bootstrap.bundle.js"></remote-js>
  <remote-js src="https://cdn.bootcss.com/twitter-bootstrap/4.2.1/js/bootstrap.js"></remote-js>
 
    <div class="card-group">
        <div class="card">
            这里是内容
        </div>
        <div class="card">
            这里是内容
        </div>
        <div class="card">
            这里是内容
        </div>
        </div>
  </div>  
</template>
<script>
 
export default {
    components:{
       'remote-css': {
            render(createElement) {            
              return createElement('link', { attrs: { rel: 'stylesheet', href: this.href }});
            },
            props: {
            href: { type: String, required: true },
            },
        },
        'remote-js': {
            render(createElement) {
              return createElement('script', { attrs: { type: 'text/javascript', src: this.src }});            
            },
            props: {
            src: { type: String, required: true },
            },
        },
    },
  name: "baseReport",
  data() {
    return {
    }
  },
  mounted(){
   
  },
  methods:{
 
  }
};
</script>
 
<style scoped>
</style>

猜你喜欢

转载自blog.csdn.net/weixin_43837268/article/details/109053286