【发布时间】:2019-12-23 16:28:06
【问题描述】:
我正在尝试使用 googleapis 为 Vue 项目在 Google 电子表格中获取一些行,并且我已经在 Google 控制台中创建了一个项目和正确的服务帐户凭据。
问题是当我单击按钮时出现此错误:TypeError: The "original" argument must be of type Function 但我使用的是这个简单的代码:
<template>
<div id="app" class="container">
<button class="button" @click="getData">Get data</button>
</div>
</template>
<script>
export default {
name: 'app',
methods: {
getData: async function() {
const { google } = require('googleapis');
const range = 'Data!A2:C999';
}
}
}
</script>
我无法理解导致此错误的原因,const { google } = require('googleapis'); 似乎有问题,但我无法弄清楚。
【问题讨论】:
标签: javascript vue.js google-sheets google-api