AppML’dan foydalanish


AppML ilovasini 2 ta oson qadamda qanday yaratish mumkin.


ULASHISH

1. HTML va CSS yordamida sahifa yarating

HTML

<!DOCTYPE html> <html lang="en-US"> <link rel="stylesheet" href="style.css"> <title>Customers</title> <body> <h1>Customers</h1> <table> <tr>   <th>Customer</th>   <th>City</th>   <th>Country</th> </tr> <tr>   <td>{{CustomerName}}</td>   <td>{{City}}</td>   <td>{{Country}}</td> </tr> </table> </body> </html>
O‘zingiz sinab ko‘ring »

{{ }} qavslari AppML ma’lumotlari uchun joy egalari hisoblanadi.

CSS

body {   font: 14px Verdana, sans-serif; } h1 {   color: #996600; } table {   width: 100%;   border-collapse: collapse; } th, td {   border: 1px solid grey;   padding: 5px;   text-align: left; } table tr:nth-child(odd) {   background-color: #f1f1f1; }

CSS’ni o‘zingizga yoqqan uslublar jadvali (style sheet) bilan bemalol almashtirishingiz mumkin.



2. AppML qo‘shing

Sahifangizga ma’lumot qo‘shish uchun AppML’dan foydalaning:

Misol

<!DOCTYPE html> <html lang="en-US"> <title>Customers</title> <link rel="stylesheet" href="style.css"> <script src="https://www.w3schools.com/appml/2.0.3/appml.js"></script> <body> <h1>Customers</h1> <table appml-data="customers.js"> <tr>   <th>Customer</th>   <th>City</th>   <th>Country</th> </tr> <tr appml-repeat="records">   <td>{{CustomerName}}</td>   <td>{{City}}</td>   <td>{{Country}}</td> </tr> </table> </body> </html>
O‘zingiz sinab ko‘ring »

AppML tushuntirilishi:

<script src="https://www.w3schools.com/appml/2.0.3/appml.js"> sahifangizga AppML’ni qo‘shadi.

appml-data="customers.js" AppML ma’lumotlarini (customers.js) HTML elementiga (<table>) bog‘laydi.

Bu holatda biz JSON fayldan foydalandik: customers.js

appml-repeat="records" ma’lumot obyektidagi har bir element (records) uchun HTML elementini (<tr>) takrorlaydi.

{{ }} qavslari AppML ma’lumotlari uchun joy egalari hisoblanadi.


W3Schools Pathfinder

Yutuqlaringizni kuzating – bu bepul!