- 配置vscode生成模板
文件->首选项->用户片段->vue.json
{
"Print to console": {
"prefix": "vue",
"body": [
"<!-- $0 -->",
"<template>",
" <div></div>",
"</template>",
"",
"<script>",
"export default {",
" data () {",
" return {",
" };",
" },",
"",
" components: {},",
"",
" computed: {},",
"",
" mounted: {},",
"",
" methods: {}",
"}",
"",
"</script>",
"<style lang='scss' scoped>",
"</style>"
],
"description": "Log output to console"
}
}
- 配置路由
路由重定向 redirect
redirect
- 渲染电子书
- 关闭eslint报错
container
package
metadata
manifest
ncxpath
spine
read-wrapper
<template>
<div class="ebook">
<div class="read-wrapper">
<div id="read"></div>
</div>
</div>
</template>
<script>
import Epub from "epubjs";
const DOWNLOAD_URL = "/static/2018_Book_AgileProcessesInSoftwareEngine.epub";
export default {
data() {
return {
book: {},
rendition: {},
};
},
components: {},
computed: {},
mounted() {
this.showEpub();
},
methods: {
showEpub() {
// 生成book对象
this.book = new Epub(DOWNLOAD_URL);
// 生成rendition 对象
this.rendition = this.book.renderTo("read", {
width: window.innerWidth,
height: window.innerHeight,
});
// 渲染节点
this.rendition.display();
},
},
};
</script>
<style lang="scss" scoped></style>