|
|
@@ -53,9 +53,9 @@
|
|
|
<h3>糟糕的变量名字</h3>
|
|
|
<div class="code java">
|
|
|
<code>
|
|
|
- var x = x - xx <br />
|
|
|
- var xxx = aretha + SalesTax( aretha )<br />
|
|
|
- var x = x + LateFee( x1, x ) + xxx <br />
|
|
|
+ var x = x - xx <br/>
|
|
|
+ var xxx = aretha + SalesTax( aretha )<br/>
|
|
|
+ var x = x + LateFee( x1, x ) + xxx <br/>
|
|
|
var x = x + Interest( x1, x )
|
|
|
</code>
|
|
|
</div>
|
|
|
@@ -66,10 +66,10 @@
|
|
|
<h3>良好的变量名字</h3>
|
|
|
<div class="code java">
|
|
|
<code>
|
|
|
- var balance = balance - lastPayment <br />
|
|
|
- var monthlyTotal = NewPurchases + SalesTax( newPurchases ) <br />
|
|
|
+ var balance = balance - lastPayment <br/>
|
|
|
+ var monthlyTotal = NewPurchases + SalesTax( newPurchases ) <br/>
|
|
|
var balance = balance + LateFee( customerID, balance ) +
|
|
|
- monthlyTotal<br />
|
|
|
+ monthlyTotal<br/>
|
|
|
var balance = balance + Interest( customerID, balance )
|
|
|
</code>
|
|
|
</div>
|
|
|
@@ -156,9 +156,9 @@
|
|
|
public PageResourceResponse getSlides(@RequestParam(required =
|
|
|
false, defaultValue = "") String key, @ApiParam(hidden = true)
|
|
|
@PageableDefault(size = Integer.MAX_VALUE, sort = "updateTime",
|
|
|
- direction = Sort.Direction.DESC) Pageable pageable) {<br />
|
|
|
+ direction = Sort.Direction.DESC) Pageable pageable) {<br/>
|
|
|
List<SlideVO> slideVOs = slideService.getSlides(key,
|
|
|
- pageable);<br />
|
|
|
+ pageable);<br/>
|
|
|
return PageResourceResponse.of(slideVOs,
|
|
|
PageResourceResponse.PageInfo.of(pageable.getPageNumber(),
|
|
|
slideVOs.size())); }
|
|
|
@@ -169,7 +169,7 @@
|
|
|
<section class="page">
|
|
|
<div>
|
|
|
<h3>*#</h3>
|
|
|
- <br />
|
|
|
+ <br/>
|
|
|
<div>// 打印 *#</div>
|
|
|
<div>// 打印一颗 * + 打印一颗 #</div>
|
|
|
</div>
|
|
|
@@ -178,7 +178,7 @@
|
|
|
<div>
|
|
|
<div class="code">
|
|
|
<code>
|
|
|
- print("*")<br />
|
|
|
+ print("*")<br/>
|
|
|
print("#")
|
|
|
</code>
|
|
|
</div>
|
|
|
@@ -186,7 +186,7 @@
|
|
|
</section>
|
|
|
<section class="page">
|
|
|
<div>
|
|
|
- <img src="./分解.png" alt="" />
|
|
|
+ <img src="./分解.png" alt=""/>
|
|
|
<div>分解(组合)</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
@@ -201,7 +201,7 @@
|
|
|
</section>
|
|
|
<section class="page">
|
|
|
<div>
|
|
|
- <img src="./好的分解和坏的分解.png" alt="" />
|
|
|
+ <img src="./好的分解和坏的分解.png" alt=""/>
|
|
|
<div>好的分解和坏的分解</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
@@ -213,21 +213,17 @@ import Hljs from '@/utils/highlight'
|
|
|
import 'highlight.js/styles/idea.css'
|
|
|
|
|
|
export default {
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
showMode: true,
|
|
|
milestones: [],
|
|
|
animating: false
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
+ mounted () {
|
|
|
this.highlightCode()
|
|
|
const handleResize = () => {
|
|
|
- if (window.innerWidth < 700) {
|
|
|
- this.showMode = false
|
|
|
- } else {
|
|
|
- this.showMode = true
|
|
|
- }
|
|
|
+ this.showMode = window.innerWidth >= 700
|
|
|
|
|
|
const pages = document.getElementsByClassName('page')
|
|
|
pages.forEach(page => {
|
|
|
@@ -251,17 +247,17 @@ export default {
|
|
|
}
|
|
|
window.addEventListener('keydown', handleSpace)
|
|
|
},
|
|
|
- updated() {
|
|
|
+ updated () {
|
|
|
this.highlightCode()
|
|
|
},
|
|
|
methods: {
|
|
|
- highlightCode() {
|
|
|
+ highlightCode () {
|
|
|
const preEl = document.querySelectorAll('.code')
|
|
|
preEl.forEach(el => {
|
|
|
Hljs.highlightBlock(el)
|
|
|
})
|
|
|
},
|
|
|
- nextPage() {
|
|
|
+ nextPage () {
|
|
|
const top = this.getCurrentScrollTop()
|
|
|
this.milestones.some(milestone => {
|
|
|
if (top < milestone - 10) {
|
|
|
@@ -272,7 +268,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- lastPage() {
|
|
|
+ lastPage () {
|
|
|
const currentPosition = this.getCurrentScrollTop()
|
|
|
let target = currentPosition
|
|
|
this.milestones.some(milestone => {
|
|
|
@@ -286,10 +282,10 @@ export default {
|
|
|
window.scrollTo(0, position)
|
|
|
)
|
|
|
},
|
|
|
- getCurrentScrollTop() {
|
|
|
+ getCurrentScrollTop () {
|
|
|
return document.documentElement.scrollTop || document.body.scrollTop
|
|
|
},
|
|
|
- scrollToY(start, end, rate, callback) {
|
|
|
+ scrollToY (start, end, rate, callback) {
|
|
|
this.animating = true
|
|
|
|
|
|
let step = () => {
|
|
|
@@ -310,8 +306,8 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-@import '@/common/reset.scss';
|
|
|
-@import '@/common/slide/slide.scss';
|
|
|
-@import '@/common/slide/page.scss';
|
|
|
-@import '@/common/slide/item.scss';
|
|
|
+@import '~@/common/reset.scss';
|
|
|
+@import '~@/common/slide/slide.scss';
|
|
|
+@import '~@/common/slide/page.scss';
|
|
|
+@import '~@/common/slide/item.scss';
|
|
|
</style>
|