添加log插件demo

This commit is contained in:
Harvey committed 2021-08-03 14:23:08 +08:00
1 parent 888c929549
commit e6242df6d3
4 files changed
+17 -1

No files matched your search

+5
View File
@@ -6,6 +6,9 @@ export default function log(art) {
let $log = null;
layers.add({
name: 'log',
style: {
bottom: '50px',
},
mounted($el) {
$log = $el;
},
@@ -17,6 +20,7 @@ export default function log(art) {
function check() {
const count = $log.childElementCount;
setStyle($log, 'bottom', art.controls.show ? '50px' : '10px');
if (count) {
if (count > max) {
remove($log.firstElementChild);
@@ -37,6 +41,7 @@ export default function log(art) {
return {
name: 'log',
emit(msg) {
if (typeof msg !== 'string') return;
append($log, `<p>${escape(msg)}</p>`);
setStyle($log, 'display', 'block');
clearTimeout(timer);