プラグイン初期作成
This commit is contained in:
25
vue-project/my-kintone-plugin/src/js/config.js
Normal file
25
vue-project/my-kintone-plugin/src/js/config.js
Normal file
@@ -0,0 +1,25 @@
|
||||
(function (PLUGIN_ID) {
|
||||
const formEl = document.querySelector('.js-submit-settings');
|
||||
const cancelButtonEl = document.querySelector('.js-cancel-button');
|
||||
const messageEl = document.querySelector('.js-text-message');
|
||||
if (!(formEl && cancelButtonEl && messageEl)) {
|
||||
throw new Error('Required elements do not exist.');
|
||||
}
|
||||
|
||||
const config = kintone.plugin.app.getConfig(PLUGIN_ID);
|
||||
if (config.message) {
|
||||
messageEl.value = config.message;
|
||||
}
|
||||
|
||||
formEl.addEventListener('submit', (e) => {
|
||||
e.preventDefault();
|
||||
kintone.plugin.app.setConfig({ message: messageEl.value }, () => {
|
||||
alert('The plug-in settings have been saved. Please update the app!');
|
||||
window.location.href = '../../flow?app=' + kintone.app.getId();
|
||||
});
|
||||
});
|
||||
|
||||
cancelButtonEl.addEventListener('click', () => {
|
||||
window.location.href = '../../' + kintone.app.getId() + '/plugin/';
|
||||
});
|
||||
})(kintone.$PLUGIN_ID);
|
||||
24
vue-project/my-kintone-plugin/src/js/desktop.js
Normal file
24
vue-project/my-kintone-plugin/src/js/desktop.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import '../css/desktop.css'
|
||||
import '../css/51-modern-default.css';
|
||||
(function (PLUGIN_ID) {
|
||||
kintone.events.on('app.record.index.show', () => {
|
||||
const spaceEl = kintone.app.getHeaderSpaceElement();
|
||||
if (spaceEl === null) {
|
||||
throw new Error('The header element is unavailable on this page.');
|
||||
}
|
||||
|
||||
const fragment = document.createDocumentFragment();
|
||||
const headingEl = document.createElement('h3');
|
||||
const messageEl = document.createElement('p');
|
||||
|
||||
const config = kintone.plugin.app.getConfig(PLUGIN_ID);
|
||||
messageEl.textContent = config.message;
|
||||
messageEl.classList.add('plugin-space-message');
|
||||
headingEl.textContent = 'Hello kintone plugin!';
|
||||
headingEl.classList.add('plugin-space-heading');
|
||||
|
||||
fragment.appendChild(headingEl);
|
||||
fragment.appendChild(messageEl);
|
||||
spaceEl.appendChild(fragment);
|
||||
});
|
||||
})(kintone.$PLUGIN_ID);
|
||||
23
vue-project/my-kintone-plugin/src/js/mobile.js
Normal file
23
vue-project/my-kintone-plugin/src/js/mobile.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import '../css/mobile.css';
|
||||
(function (PLUGIN_ID) {
|
||||
kintone.events.on('mobile.app.record.index.show', () => {
|
||||
const spaceEl = kintone.mobile.app.getHeaderSpaceElement();
|
||||
if (spaceEl === null) {
|
||||
throw new Error('The header element is unavailable on this page.');
|
||||
}
|
||||
|
||||
const fragment = document.createDocumentFragment();
|
||||
const headingEl = document.createElement('h3');
|
||||
const messageEl = document.createElement('p');
|
||||
|
||||
const config = kintone.plugin.app.getConfig(PLUGIN_ID);
|
||||
messageEl.textContent = config.message;
|
||||
messageEl.classList.add('plugin-space-message');
|
||||
headingEl.textContent = 'Hello kintone plugin!';
|
||||
headingEl.classList.add('plugin-space-heading');
|
||||
|
||||
fragment.appendChild(headingEl);
|
||||
fragment.appendChild(messageEl);
|
||||
spaceEl.appendChild(fragment);
|
||||
});
|
||||
})(kintone.$PLUGIN_ID);
|
||||
Reference in New Issue
Block a user