mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
1 line
2.4 KiB
JavaScript
1 line
2.4 KiB
JavaScript
(()=>{return(e,t)=>{const a=`<div class=feeds><div class=header><div class=title>动态</div><div class=tabs><div class=tab v-for="tab of tabs":key=tab.type :class="{active: tab === currentTab}"@click="currentTab = tab"><div class=tab-name>{{tab.name}}</div></div></div><div class=flex-grow></div><a class=more><icon type=mdi icon=dots-horizontal></icon>更多</a></div><div class=contents-wrapper><div class=contents><div class=card-wrapper v-for="card in feeds":key=card.id><video-card :data=card orientation=vertical></video-card></div></div></div></div>`;t.applyStyleFromText(`.simple-home .feeds{width:calc(100% + 16px);justify-self:center;display:flex;align-items:stretch;flex-direction:column}.simple-home .feeds .header{padding:0 8px}.simple-home .feeds .header .flex-grow{flex-grow:1}.simple-home .feeds .header .tabs{margin-left:24px;display:flex;align-items:center}.simple-home .feeds .header .tabs .tab{cursor:pointer;position:relative}.simple-home .feeds .header .tabs .tab .tab-name{opacity:.5;font-size:14px}.simple-home .feeds .header .tabs .tab:not(:last-child){margin-right:24px}.simple-home .feeds .header .tabs .tab::after{content:"";width:calc(80%);height:3px;border-radius:2px;position:absolute;background-color:var(--theme-color);left:10%;bottom:-6px;transform:scaleX(0);transition:.2s ease-out}.simple-home .feeds .header .tabs .tab.active::after{transform:scaleX(1)}.simple-home .feeds .header .tabs .tab.active .tab-name{font-weight:700;opacity:1;transform:scale(1.1)}.simple-home .feeds .contents-wrapper{margin-top:16px;display:flex;width:100%}.simple-home .feeds .contents-wrapper .contents{--card-width:200px;--card-height:250px;padding-bottom:16px;display:flex;overflow:auto;scroll-snap-type:x mandatory;scrollbar-width:none!important;width:0;flex:1 0 0}.simple-home .feeds .contents-wrapper .contents::-webkit-scrollbar{width:0!important;height:0!important}.simple-home .feeds .contents-wrapper .contents .card-wrapper{padding:0 8px;scroll-snap-align:start;flex-shrink:0}`,"simple-home-feeds-style");const s=[{name:"视频",type:"video"},{name:"番剧",type:"bangumi"}];return{export:Object.assign({template:a},{components:{VideoCard:()=>t.importAsync("video-card.vue"),Icon:()=>t.importAsync("icon.vue")},data(){return{tabs:s,currentTab:s[0],feeds:[]}},watch:{currentTab(e){this.updateFeedsTab(e)}},methods:{async updateFeedsTab(e){const{getVideoFeeds:a}=await t.importAsync("feeds-apis");this.feeds=await a(e.type)}},mounted(){this.updateFeedsTab(this.currentTab)}})}}})(); |