在CodePen中使用Vue模块

问题描述

我正在使用CodePen.io重新创建一个Vue组件,但我遇到了无法正常工作的问题。该脚本包括使用模块导入,但是添加Vue moduel的行正在破坏该组件,而没有留下任何错误

以下Codepen代码段有效...

import VueGoogleApi from 'https://assets.codepen.io/2436586/gapi.js';

const config = {
  apiKey: 'Ot2_iZE8V4KG8ysw6t4ZZ8Rz',clientId: '54556258044-ooudplep6956ik9gb481en050c91b8jk.apps.googleusercontent.com',scope: 'https://www.googleapis.com/auth/documents https://www.googleapis.com/auth/userinfo.profile',discoveryDocs: [ 'https://docs.googleapis.com/$discovery/rest?version=v1' ]
}

// This line is breaking the script when it is uncommented
// Vue.use(VueGoogleApi,config);

new Vue({
  el: '#app',vuetify: new Vuetify(),data () {
    return {
      
    }
  },methods: {
    invokeGapi() {
      console.log('invoked');
      /*
      this.$gapi.isSignedIn()
                  .then(result => {
                    console.log(result ? 'Signed in' : 'Signed out')
                  });
          */
    }
  }
})

https://codepen.io/deftonez4me/pen/abZYaNY?editors=1011

...直到取消注释添加导入的Vue插件的行。

Vue.use(VueGoogleApi,config);

为什么添加插件会破坏脚本?

解决方法

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

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

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