i18n改用json格式

This commit is contained in:
Harvey Zack committed 2019-05-06 09:12:36 +08:00
1 parent ffd7a38b35
commit 0bc9c88af2
18 files changed
+211 -184

No files matched your search

+9 -2
View File
@@ -1,4 +1,4 @@
import { append, insertByIndex, setStyles, setStyle, remove } from './index';
import { append, setStyles, setStyle, remove } from './index';
export default function component(art, parent, target, getOption, callback, title) {
const option = typeof getOption === 'function' ? getOption(art) : getOption;
@@ -15,7 +15,14 @@ export default function component(art, parent, target, getOption, callback, titl
setStyles($element, option.style);
}
insertByIndex(target, $element, option.index || parent.id);
const childs = Array.from(target.children);
$element.dataset.index = option.index || parent.id;
const nextChild = childs.find(item => Number(item.dataset.index) >= Number($element.dataset.index));
if (nextChild) {
nextChild.insertAdjacentElement('beforebegin', $element);
} else {
append(target, $element);
}
if (option.click) {
art.events.proxy($element, 'click', event => {