fix format
This commit is contained in:
@@ -7,55 +7,53 @@ import { Button } from 'kintone-ui-component/lib/button';
|
||||
(function (PLUGIN_ID) {
|
||||
kintone.events.on('app.record.index.show', async () => {
|
||||
// 授权了才能使用
|
||||
LicenseService.loadPluginIfAuthorized(PLUGIN_ID,
|
||||
async () => {
|
||||
// 获取当前应用ID
|
||||
const appIdNum = kintone.app.getId();
|
||||
if (!appIdNum) {
|
||||
return;
|
||||
LicenseService.loadPluginIfAuthorized(PLUGIN_ID, async () => {
|
||||
// 获取当前应用ID
|
||||
const appIdNum = kintone.app.getId();
|
||||
if (!appIdNum) {
|
||||
return;
|
||||
}
|
||||
const appId = appIdNum.toString();
|
||||
|
||||
// 从插件配置中读取设置信息
|
||||
const setting: Setting = kintone.plugin.app.getConfig(PLUGIN_ID);
|
||||
|
||||
// 检查按钮是否已存在,防止翻页时重复添加
|
||||
const btnId = 'template-btn-id';
|
||||
if (document.getElementById(btnId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 测试 i18n
|
||||
const { t } = i18n.global;
|
||||
|
||||
// 获取 Header 容器元素
|
||||
const headerSpace = kintone.app.getHeaderMenuSpaceElement();
|
||||
if (!headerSpace) {
|
||||
throw new Error(t('error.noAreaError'));
|
||||
}
|
||||
|
||||
// 创建按钮
|
||||
const button = new Button({
|
||||
text: setting.buttonName,
|
||||
type: 'submit',
|
||||
id: btnId,
|
||||
});
|
||||
button.addEventListener('click', async () => {
|
||||
try {
|
||||
// 测试 KintoneRestAPIClient,显示所有已启用的插件名
|
||||
const { plugins } = await client.app.getPlugins({
|
||||
app: appId,
|
||||
});
|
||||
const pluginsInfo = plugins.map((p) => p.name).join('、');
|
||||
|
||||
const message = t('hello') + '\n' + setting.message + '\n--------\n【Plugins】 ' + pluginsInfo;
|
||||
alert(message);
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch plugins:', error);
|
||||
}
|
||||
const appId = appIdNum.toString();
|
||||
|
||||
// 从插件配置中读取设置信息
|
||||
const setting: Setting = kintone.plugin.app.getConfig(PLUGIN_ID);
|
||||
|
||||
// 检查按钮是否已存在,防止翻页时重复添加
|
||||
const btnId = 'template-btn-id';
|
||||
if (document.getElementById(btnId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 测试 i18n
|
||||
const { t } = i18n.global;
|
||||
|
||||
// 获取 Header 容器元素
|
||||
const headerSpace = kintone.app.getHeaderMenuSpaceElement();
|
||||
if (!headerSpace) {
|
||||
throw new Error(t('error.noAreaError'));
|
||||
}
|
||||
|
||||
// 创建按钮
|
||||
const button = new Button({
|
||||
text: setting.buttonName,
|
||||
type: 'submit',
|
||||
id: btnId,
|
||||
});
|
||||
button.addEventListener('click', async () => {
|
||||
try {
|
||||
// 测试 KintoneRestAPIClient,显示所有已启用的插件名
|
||||
const { plugins } = await client.app.getPlugins({
|
||||
app: appId,
|
||||
});
|
||||
const pluginsInfo = plugins.map((p) => p.name).join('、');
|
||||
|
||||
const message = t('hello') + '\n' + setting.message + '\n--------\n【Plugins】 ' + pluginsInfo;
|
||||
alert(message);
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch plugins:', error);
|
||||
}
|
||||
});
|
||||
headerSpace.appendChild(button);
|
||||
},
|
||||
);
|
||||
});
|
||||
headerSpace.appendChild(button);
|
||||
});
|
||||
});
|
||||
})(kintone.$PLUGIN_ID);
|
||||
|
||||
@@ -7,55 +7,53 @@ import { MobileButton } from 'kintone-ui-component/lib/mobile/button';
|
||||
(function (PLUGIN_ID) {
|
||||
kintone.events.on('mobile.app.record.index.show', () => {
|
||||
// 授权了才能使用
|
||||
LicenseService.loadPluginIfAuthorized(PLUGIN_ID,
|
||||
async () => {
|
||||
// 获取当前应用ID
|
||||
const appIdNum = kintone.mobile.app.getId();
|
||||
if (!appIdNum) {
|
||||
return;
|
||||
};
|
||||
const appId = appIdNum.toString();
|
||||
LicenseService.loadPluginIfAuthorized(PLUGIN_ID, async () => {
|
||||
// 获取当前应用ID
|
||||
const appIdNum = kintone.mobile.app.getId();
|
||||
if (!appIdNum) {
|
||||
return;
|
||||
};
|
||||
const appId = appIdNum.toString();
|
||||
|
||||
// 从插件配置中读取设置信息
|
||||
const setting: Setting = kintone.plugin.app.getConfig(PLUGIN_ID);
|
||||
// 从插件配置中读取设置信息
|
||||
const setting: Setting = kintone.plugin.app.getConfig(PLUGIN_ID);
|
||||
|
||||
// 检查按钮是否已存在,防止翻页时重复添加
|
||||
const btnId = 'template-btn-id';
|
||||
if (document.getElementById(btnId)) {
|
||||
return;
|
||||
};
|
||||
// 检查按钮是否已存在,防止翻页时重复添加
|
||||
const btnId = 'template-btn-id';
|
||||
if (document.getElementById(btnId)) {
|
||||
return;
|
||||
};
|
||||
|
||||
// 测试 i18n
|
||||
const { t } = i18n.global;
|
||||
// 测试 i18n
|
||||
const { t } = i18n.global;
|
||||
|
||||
// 获取 Header 容器元素
|
||||
const headerSpace = kintone.mobile.app.getHeaderSpaceElement();
|
||||
if (!headerSpace) {
|
||||
throw new Error(t('error.noAreaError'));
|
||||
// 获取 Header 容器元素
|
||||
const headerSpace = kintone.mobile.app.getHeaderSpaceElement();
|
||||
if (!headerSpace) {
|
||||
throw new Error(t('error.noAreaError'));
|
||||
}
|
||||
|
||||
// 创建按钮
|
||||
const button = new MobileButton({
|
||||
text: setting.buttonName,
|
||||
type: 'submit',
|
||||
id: btnId,
|
||||
});
|
||||
button.addEventListener('click', async () => {
|
||||
try {
|
||||
// 测试 KintoneRestAPIClient,显示所有已启用的插件名
|
||||
const { plugins } = await client.app.getPlugins({
|
||||
app: appId,
|
||||
});
|
||||
const pluginsInfo = plugins.map((p) => p.name).join('、');
|
||||
|
||||
const message = t('hello') + "\n" + setting.message + '\n--------\n【Plugins】 ' + pluginsInfo;
|
||||
alert(message);
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch plugins:', error);
|
||||
}
|
||||
|
||||
// 创建按钮
|
||||
const button = new MobileButton({
|
||||
text: setting.buttonName,
|
||||
type: 'submit',
|
||||
id: btnId,
|
||||
});
|
||||
button.addEventListener('click', async () => {
|
||||
try {
|
||||
// 测试 KintoneRestAPIClient,显示所有已启用的插件名
|
||||
const { plugins } = await client.app.getPlugins({
|
||||
app: appId,
|
||||
});
|
||||
const pluginsInfo = plugins.map((p) => p.name).join('、');
|
||||
|
||||
const message = t('hello') + "\n" + setting.message + '\n--------\n【Plugins】 ' + pluginsInfo;
|
||||
alert(message);
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch plugins:', error);
|
||||
}
|
||||
});
|
||||
headerSpace.appendChild(button);
|
||||
},
|
||||
);
|
||||
});
|
||||
headerSpace.appendChild(button);
|
||||
});
|
||||
});
|
||||
})(kintone.$PLUGIN_ID);
|
||||
Reference in New Issue
Block a user