20 lines
553 B
TypeScript
20 lines
553 B
TypeScript
import { type App } from 'vue';
|
||
import { KintoneRestAPIClient } from '@kintone/rest-api-client';
|
||
|
||
// 创建客户端实例(单例)
|
||
const client = new KintoneRestAPIClient();
|
||
|
||
// 创建注入的 Symbol(用于类型安全)
|
||
export const KintoneClientInjectionKey = Symbol('kintone-client');
|
||
|
||
// 插件安装函数
|
||
export const kintoneClientPlugin = {
|
||
install(app: App) {
|
||
// 提供给整个应用使用
|
||
app.provide(KintoneClientInjectionKey, client);
|
||
},
|
||
};
|
||
|
||
// 导出客户端实例作为默认
|
||
export default client;
|