Skip to content

Commit 6c34110

Browse files
authored
Merge pull request #7 from TanHongIT/5-api
note
2 parents d42ae4f + 21d1329 commit 6c34110

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

app/Http/Controllers/StudentController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function save_student()
1919

2020
public function all_students()
2121
{
22-
$students = Student::paginate(5);
22+
$students = Student::orderBy('created_at', 'desc')->paginate(5);
2323
return response()->json($students);
2424
}
2525

public/note

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ vue router = router
2424
+v-on:[ten su kien]="sgtregre"
2525
viet tat: v-on:click -> @click
2626
+Prevent default event:
27-
+ huy bo event mac dinh cua element di -> lamf tiep cai gi do theo y thich
27+
+ huy bo event mac dinh cua element di -> lam tiep cai gi do theo y thich
28+
https://viblo.asia/p/bai-14-event-handling-voi-vuejs-3P0lPze8Kox
2829

2930
+ ref:
3031
Anh xa den chinh element
@@ -40,30 +41,37 @@ vue router = router
4041
+v-for
4142

4243
+methods:
43-
+function cua vue object
44+
+function cua vue object (là danh sách các phương thức của component)
4445

45-
+watch
46-
Thao doi su thay doi cua data
46+
+watch (watcher)
47+
Theo doi su thay doi cua data
48+
Với việc sử dụng watch có thể giúp chúng ta theo dõi sự thay đổi và sau đó thực hiện những tính toán phức tạp
4749

4850
+hood:
49-
mounted
51+
created: thường dùng để gọi API lấy dữ liệu từ server, khởi tạo websocket, lắng nghe event Laravel Echo,... miễn là ta không động gì vào DOM thật là được
5052

51-
Props:
53+
mounted: đưa component ra trình duỵet
54+
55+
+Props:
5256
Dua du lieu day tu component cha sang component con
5357
Cach khai bao:
5458
+dung mang ten cac prop
5559
+dungf object
5660

5761
Props =data
5862

59-
Event:
63+
+Lí do vì sao không dùng JQuery được ở created: Vì ở created là ta mới chỉ có DOM ảo được tạo ra, mà jquery thì chỉ thao tác được với DOM thật, do đó nên nếu muốn dùng JQuery ta cần làm ở mounted (khi DOM ảo đã được đồng bộ với DOM thật)
6064

6165
filter:
6266
bien doi du lieu truoc khi no dc render
6367

6468
https://stackoverflow.com/questions/149055/how-to-format-numbers-as-currency-string
6569
https://www.youtube.com/watch?v=j97QtHf0CHY&t=882s
6670

71+
+scoped:
72+
https://viblo.asia/p/bai-15-scoped-css-trong-vuejs-va-cac-ki-thuat-lien-quan-63vKjakd52R
73+
74+
6775
pagination laravel vue: https://github.com/gilbitron/laravel-vue-pagination
6876

6977
https://viblo.asia/p/restful-api-trong-laravel-cho-nguoi-moi-bat-dau-ByEZkNaqKQ0

0 commit comments

Comments
 (0)