主题设置功能
2020-07-25 14:14
71 查看
this.themes.register(name, style)// this.themes.register将我们的主题注册到themes对象当中 this.themes.select(name)//可以通过主题的名称快速的切换主题
创建主题数组
themeList: [ { name: 'default', style: { body: { 'color': '#000', 'background': '#fff' } } }, { name: 'eye', style: { body: { 'color': '#000', 'background': '#ceeaba' } } }, { name: 'nignt', style: { body: { 'color': '#fff', 'background': '#000' } } }, { name: 'gold', style: { body: { 'color': '#000', 'background': 'rgb(241,236,226)' } } } ]
methods: { setTheme(index) { this.themes.select(this.themeList[index].name) this.defaultTheme = index }, registerTheme() { this.themeList.forEach(theme => { this.themes.register(theme.name, theme.style) }) }, showEpubs() { this.book = new Epub(DOWNLOAD_URL) this.rendition = this.book.renderTo('read', { width: window.innerWidth, height: window.innerHeight } ), this.registerThemes() this.setTheme(this.defaultTheme) } }
data () { return { defaultTheme: 0 } }
<div class="settting-theme"> <div class="setting-theme-item" v-for="(item,index) in themeList" :key="index"> <div class="preview" :style="background: item.style.body.background "></div> <div class="text">{{item.name}}</div> </div> </div> .setting-theme{ height: 100%; //高度撑满 display: flex; .setting-thme-item{ flex: 1; // display: flex; flex-direction: column; .preview{ flex: 1; } .text{ flex: 0 0 px2rem(30); font-size: px2rem(16); } } }
相关文章推荐
- django1.9+xadmin设置主题功能失败的解决方法(含xadmin的源码下载地址)
- 黄聪:WordPress 多站点建站教程(二):后台(管理网络)设置详解,如何管理子站的用户、主题、插件、设置等功能
- Oracle Flashback 闪回功能的设置和使用
- Android 设置主题实现点击波纹效果的示例
- 如何设置脑图软件Mindmaster背景主题
- 设置eclipse自动提示功能
- 博客园 打赏功能设置,友言,友荐,分享功能设置
- Eclipse for android 设置代码提示功能
- TL-R406 IP带宽控制功能设置指南
- Android Studio主题设置、颜色背景配置
- VS 2012 深色主题下的字体与颜色设置
- 在xfce环境下设置笔记本触摸板的点击功能
- Mediawiki邮件功能设置
- Eclipse黑色主题设置
- (转)Android Activity 常用功能设置(全屏、横竖屏、持续亮屏等)
- android 设置头像以及裁剪功能
- “ 设置>备份和重置>恢复出厂设置 “这个功能是做什么的?
- 文件打印功能全面设置收藏
- Quartus II 功能仿真设置流程
- netbeans设置代码自动补全功能