0

我有一个 react 项目,它通过内容脚本将自己注入到 chrome 扩展中。我已经安装了 @types/chrome 并在我的 app.tsx 中包含了

/// <reference types="chrome"> 

并尝试/* global chrome */过。但是,我继续收到 TypeError:无法读取未定义的属性“查询”。

在我的 app.tsx 中,我调用了 api:

chrome.tabs.query({ active:true,  currentWindow:true}, (tabs:chrome chrome.tabs.Tab[]) => { ....

从本教程来看: https
://blog.usejournal.com/making-an-interactive-chrome-extension-with-react-524483d7aa5d 我认为我在正确的轨道上。有什么建议么?谢谢!

4

0 回答 0