From 343cf59e1d58d8ff1619729570a822faa3ba58ee Mon Sep 17 00:00:00 2001 From: zyronon Date: Thu, 9 Sep 2021 23:55:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BAdom=E7=B1=BB=EF=BC=8C?= =?UTF-8?q?=E4=BB=A3=E6=9B=BFjquery=E7=9A=84=E4=B8=80=E4=BA=9B=E7=AE=80?= =?UTF-8?q?=E5=8D=95=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/img/icon/loved.svg | 2 +- src/config/index.js | 4 +- src/pages/Test2.vue | 104 ++++++++++---- src/pages/Test3.vue | 253 ++++++++++++---------------------- src/pages/home/Index2.vue | 2 +- src/utils/dom.js | 69 ++++++++++ 6 files changed, 244 insertions(+), 190 deletions(-) create mode 100644 src/utils/dom.js diff --git a/src/assets/img/icon/loved.svg b/src/assets/img/icon/loved.svg index 7a14a6a..e03e9b6 100644 --- a/src/assets/img/icon/loved.svg +++ b/src/assets/img/icon/loved.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/config/index.js b/src/config/index.js index d8a9f81..930589f 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -1,6 +1,6 @@ export default { - baseUrl: 'http://192.168.0.105/index.php/v1', - filePreview:'http://192.168.0.105/static/uploads/', + baseUrl: 'http://192.168.0.103/index.php/v1', + filePreview:'http://192.168.0.103/static/uploads/', // baseUrl: 'http://192.168.10.164/index.php/v1', // filePreview:'http://192.168.10.164/static/uploads/' // baseUrl: 'http://localhost/index.php/v1', diff --git a/src/pages/Test2.vue b/src/pages/Test2.vue index 75f0158..abd4a06 100644 --- a/src/pages/Test2.vue +++ b/src/pages/Test2.vue @@ -1,36 +1,94 @@ - diff --git a/src/pages/home/Index2.vue b/src/pages/home/Index2.vue index 0e6aaf7..714f1a7 100644 --- a/src/pages/home/Index2.vue +++ b/src/pages/home/Index2.vue @@ -290,7 +290,7 @@ export default { { "id": "21c4d0e6-4895-44cf-abae-1ad6d4e51cfe", "posterUrl": "images/20210815/11.png", - "videoUrl": mp42, + "videoUrl": c, "title": "", "likeNum": "4312856", "commentNum": "14431", diff --git a/src/utils/dom.js b/src/utils/dom.js new file mode 100644 index 0000000..40d286e --- /dev/null +++ b/src/utils/dom.js @@ -0,0 +1,69 @@ +export default class Dom { + + constructor() { + + } + + find(tag) { + let els = document.querySelectorAll(tag) + if (els.length) { + this.els = els + } + return this + } + + create(template) { + let tempNode = document.createElement('div'); + tempNode.innerHTML = template; + this.els = [tempNode.firstChild] + return this; + } + + append(that) { + this.els.forEach(el => { + that.els.map(v => { + el.appendChild(v) + }) + }) + return this + } + + remove() { + this.els.forEach(el => { + el.parentNode.removeChild(el) + }) + return this + } + + css(style, value = null) { + if (!value) { + Object.keys(style).map(key => { + this.els.map(el => { + el.style[key] = this.getStyleValue(key, style[key]) + }) + } + ) + } else { + this.els.map(el => { + el.style[style] = this.getStyleValue(style, value) + }) + } + return this + } + + getStyleValue(key, value) { + let whiteList = [ + 'top', + 'left', + 'right', + 'bottom', + ] + if (whiteList.find(v => v === key)) { + if (typeof value === 'number') { + return value + 'px' + } + } else { + return value + } + } +} \ No newline at end of file