From a211483dcc2a68831df3f4af0576c9241c5facdc Mon Sep 17 00:00:00 2001 From: zyronon Date: Thu, 2 Dec 2021 23:39:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=86=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Video.vue | 1 + src/pages/home/Index2.vue | 1 - src/pages/test/TestSlide.vue | 101 +++++++++++++++++++++++++++++++++++ src/pages/test/slide.js | 56 +++++++++++++++++++ src/router/routes.js | 2 + 5 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 src/pages/test/TestSlide.vue create mode 100644 src/pages/test/slide.js diff --git a/src/components/Video.vue b/src/components/Video.vue index 805e037..b6011a5 100644 --- a/src/components/Video.vue +++ b/src/components/Video.vue @@ -417,6 +417,7 @@ export default { margin: auto; left: 0; top: 0; + top: 0; bottom: 0; right: 0; animation: pause-animation 1.1s linear; diff --git a/src/pages/home/Index2.vue b/src/pages/home/Index2.vue index 7edc3e5..6312b89 100644 --- a/src/pages/home/Index2.vue +++ b/src/pages/home/Index2.vue @@ -97,7 +97,6 @@ :list="videos" :renderSlide="render" v-model:active-index="videoActiveIndex" - v-model:active-index1="videoActiveIndex" @end="end" > diff --git a/src/pages/test/TestSlide.vue b/src/pages/test/TestSlide.vue new file mode 100644 index 0000000..504102f --- /dev/null +++ b/src/pages/test/TestSlide.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/src/pages/test/slide.js b/src/pages/test/slide.js new file mode 100644 index 0000000..5e45d99 --- /dev/null +++ b/src/pages/test/slide.js @@ -0,0 +1,56 @@ +import Dom from "../../utils/dom"; +import * as Vue from "vue"; + +export default class Slide { + constructor(id, config) { + let container = new Dom(id) + this.wrapper = new Dom().create('
') + this.list = new Dom().create('
') + this.list.on('touchstart', () => { + console.log('touchstart') + }) + this.list.on('touchmove', () => { + console.log('touchmove') + }) + this.list.on('touchend', () => { + console.log('touchend') + }) + this.wrapper.append(this.list) + container.append(this.wrapper) + this.totalSize = 52 + this.pageSize = 10 + this.pageNo = 0 + this.config = config + this.appInsMap = new Map() + this.getData() + } + + async getData() { + if (this.config.request) { + let res = await this.config.request({pageNo: this.pageNo, pageSize: this.pageSize}) + if (res.code === 200) { + res.data.list.map((v, i) => { + let el = this.getInsEl(v, i, false) + let item = new Dom().create('
') + item.append(new Dom(el)) + this.list.append(item) + }) + } + } + } + + getInsEl(item, index, play = false) { + // console.log('index',index,play) + let slideVNode = this.config.render(item, index, play) + const app = Vue.createApp({ + render() { + return slideVNode + } + }) + const parent = document.createElement('div') + const ins = app.mount(parent) + this.appInsMap.set(index, app) + // this.appInsMap.set(index, ins) + return ins.$el + } +} \ No newline at end of file diff --git a/src/router/routes.js b/src/router/routes.js index 1174e36..e659eca 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -71,6 +71,7 @@ import VerificationCode from "../pages/login/VerificationCode"; import RetrievePassword from "../pages/login/RetrievePassword"; import Help from "../pages/login/Help"; import Uploader from "../pages/me/Uploader"; +import TestSlide from "../pages/test/TestSlide"; const routes = [ // {path: '', component: Music}, @@ -81,6 +82,7 @@ const routes = [ {path: '/test3', component: Test3}, {path: '/test4', component: Test4}, {path: '/test5', component: Test5}, + {path: '/TestSlide', component: TestSlide}, {path: '/TestVue3', component: TestVue3}, {path: '/TestKeepAlive', component: TestKeepAlive}, {path: '/TestKeepAlivePage1', component: TestKeepAlivePage1},