修复插件配置问题

This commit is contained in:
2022-08-17 12:56:26 +08:00
parent 6632d8cea1
commit 916507d7f2
5 changed files with 205 additions and 26 deletions

View File

@ -1,19 +1,28 @@
import PickleComplate from "../vendor/picomplete/picomplete";
(function () {
new PickleComplate({
request: {
url: '/programs/construct/append/from_list?',
type: 'GET',
value: 'from',
text: 'from',
},
config: {
type: 'server',
target: '#from_select',
clickCallback: (target, node) => {
target.value = node.value;
},
},
})
const pickle_config = {
target: '#from_select',
suggest: ["alias", "abbr"],
clickCallback: (target, node) => {
target.value = node.value;
}
};
let local_data_string = window.localStorage.getItem("append_from_list");
if (!local_data_string) {
return fetch("/programs/construct/append/from_list", {
"method": "GET",
}).then((response) => response.json()).then((data) => {
window.localStorage.setItem("append_from_list", JSON.stringify(data));
new PickleComplate({
data: data,
config: pickle_config,
})
});
} else {
new PickleComplate({
data: JSON.parse(local_data_string),
config: pickle_config,
})
}
})()