AppML လုပ်နည်း


လွယ်ကူသော အဆင့် ၂ ဆင့် ဖြင့် AppML Application တစ်ခုကို တည်ဆောက်နည်း


1. HTML နှင့် CSS ကိုအသုံးပြု၍ စာမျက်နှာတစ်ခုဖန်တီးပါ။

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>

{{ }} ကွင်းပိတ် များသည် AppML ဒေတာအတွက် နေရာပေးထားပါသည်။

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 ကို သင့်စိတ်ကြိုက်စတိုင်စာရွက်ဖြင့် အခမဲ့ အစားထိုးလိုက်ပါ။


2. AppML ကိုထည့်ပါ။

သင့်စာမျက်နှာသို့ ဒေတာထည့်ရန် AppML ကိုသုံးပါ-

ဥပမာ

<!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>

AppML မှ ရှင်းပြထားသည်

<script src="https://www.w3schools.com/appml/2.0.3/appml.js"> သည် သင့်စာမျက်နှာသို့ AppML ကို ထည့်သည်။

appml-data = "customers.js" သည် AppML ဒေတာ (customers.js) ကို HTML အစိတ်အပိုင်း (<table>) နှင့် ချိတ်ဆက်သည်။

ဤကိစ္စတွင် ကျွန်ုပ်တို့သည် JSON ဖိုင်-

appml-repeat="records" သည် ဒေတာအရာဝတ္တုတစ်ခုစီရှိ အကြောင်းအရာတစ်ခုစီအတွက် (<tr>) HTML အစိတ်အပိုင်း (<tr>) ကို ပြန်ဆိုသည်။

{{ }} ကွင်းပိတ် များသည် AppML ဒေတာအတွက် နေရာပေးထားပါသည်။