Skip to content

Instantly share code, notes, and snippets.

View 12cassie34's full-sized avatar

Cassie 12cassie34

View GitHub Profile
@12cassie34
12cassie34 / vuePagination.js
Created January 4, 2022 09:59
Vue Pagination - Step 2-4
const start = this.currentPage * this.itemsPerPage - this.itemsPerPage;
const end = start + this.itemsPerPage;
@12cassie34
12cassie34 / vuePagination.js
Created January 4, 2022 09:58
Vue Pagination - Step2-3
computed: {
totalPages: function() {
return Math.ceil(this.dataAmount / this.itemsPerPage)
},
currentContents: function() {
// 檢查 Array 的資料是否為空
if (!this.cities || this.cities.length != this.cities.length) {
return;
}
@12cassie34
12cassie34 / vuePagination.js
Created January 4, 2022 09:57
Vue Pagination - Step2-2
computed: {
totalPages: function() {
return Math.ceil(this.dataAmount / this.itemsPerPage)
},
}
@12cassie34
12cassie34 / vuePagination.js
Created January 4, 2022 09:56
Vue Pagination - Step 2-1
methods: {
changeCurrentPage(pageNumber) {
this.currentPage = pageNumber
},
parseItemsPerPage() {
this.itemsPerPage = +this.itemsPerPage;
}
}
@12cassie34
12cassie34 / gist:66c5b78aa7e1529a81efedde6b7485bc
Last active January 4, 2022 09:54
Vue Pagination - Step 1
data() {
return {
currentPage: 1,
itemsPerPage: 1,
dataAmount: 0,
cities: [
{
id: 1,
name: "Paris"
},
@12cassie34
12cassie34 / step1.css
Created November 24, 2021 09:01
Z-index and Stacking Context - side tab example - step 1
.main-content {
margin-top: 50px;
margin-bottom: 50px;
position: relative; // here
z-index: 0; // here
}
button {
margin-top: 20px;
}
@12cassie34
12cassie34 / side-tab.html
Created November 24, 2021 09:00
Z-index and Stacking Context - side tab example
<section class="main-content">
<div class="text">
艾菲爾鐵塔(法語:La Tour Eiffel,也常稱為巴黎鐵塔)是位於法國巴黎第七區、塞納河畔戰神廣場的鐵製鏤空塔,世界著名建築,也是法國文化象徵之一,巴黎城市地標之一,巴黎最高建築物。正式地址為Rue Anatole-France 5號。<br>
...
</div>
<!-- Button trigger modal -->
<a href="#secretModal" class="btn btn-primary">鐵塔小祕密</a>
<!-- Modal -->
<div id="secretModal" class="modal">
@12cassie34
12cassie34 / step4-3.css
Created November 24, 2021 07:54
Z-index and Stacking Context - CSS - Step 4-2
.img--bottom {
margin-top: -100px;
// here
position: relative;
z-index: 0;
// end here
float: right;
transform: rotate(180deg);
}
@12cassie34
12cassie34 / step4-1.css
Created November 24, 2021 07:53
Z-index and Stacking Context - CSS - Step 4-1
.text {
padding: 15px;
border-radius: 10px;
position: relative;
z-index: 1; // here
background-color: #67595E;
color: white;
}
@12cassie34
12cassie34 / step3.css
Created November 24, 2021 07:48
Z-index and Stacking Context - CSS - Step 3
.img--bottom {
margin-top: -100px;
float: right;
transform: rotate(180deg); // add here
}