32/12/2023
This commit is contained in:
44
dist/detail.js
vendored
Normal file
44
dist/detail.js
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
function get_sp_tu_api() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return new Promise((resolve, reject) => {
|
||||
return resolve(listproduct_mau);
|
||||
});
|
||||
});
|
||||
}
|
||||
function show_info_product() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const lay_thongtin_sp = yield get_sp_tu_api();
|
||||
// code hien thi danh sach dang dien ra
|
||||
show_product_detail(lay_thongtin_sp);
|
||||
});
|
||||
}
|
||||
function GetURLParameter(sParam, url) {
|
||||
var url_decode = decodeURIComponent(url);
|
||||
var sPageURL = url_decode;
|
||||
var sURLVariables = sPageURL.split('?');
|
||||
for (var i = 0; i < sURLVariables.length; i++) {
|
||||
var sParameterName = sURLVariables[i].split('=');
|
||||
if (sParameterName[0] == sParam) {
|
||||
return sParameterName[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
function show_product_detail(lay_thongtin_sp) {
|
||||
const IdProduct = Number(GetURLParameter('id', window.location.href));
|
||||
lay_thongtin_sp
|
||||
.filter((product) => product.productId == IdProduct)
|
||||
.forEach(function (product, keyIndex) {
|
||||
console.log(product);
|
||||
});
|
||||
}
|
||||
show_info_product();
|
||||
Reference in New Issue
Block a user