Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

AppML 参考


AppML HTML 属性

示例

<div appml-include-html="inc_header.htm"></div>

<h1>客户</h1>
<table appml-data="customers.js" appml-controller="myController">
  <tr>
    <th>客户</th>
    <th>城市</th>
    <th>国家</th>
  </tr>
  <tr appml-repeat="records">
    <td>{{CustomerName}}</td>
    <td>{{City}}</td>
    <td>{{Country}}</td>
  </tr>
</table>

<div appml-include-html="inc_footer.htm"></div>
自己试试 »
属性 描述 解释
appml-controller 定义 AppML 控制器 AppML 控制器
appml-data 定义应用程序的数据源 AppML 数据
appml-include-html 定义要包含的 HTML AppML 包含
appml-repeat 定义要重复的 HTML 元素 AppML 如何

AppML 消息

示例

function myController($appml) {
    if ($appml.message == "display") {
        if ($appml.display.name == "CustomerName") {
            $appml.display.value = $appml.display.value.toUpperCase();
        }
    }
}
自己试试 »
消息 发送
ready AppML 初始化后,准备加载数据。
loaded AppML 加载完毕后,准备显示数据。
display AppML 显示数据项之前。
done AppML 完成(完成显示)后。
submit AppML 提交数据之前。
error AppML 遇到错误后。

AppML 消息在关于 AppML 消息 的章节中解释。



AppML 模型

示例

{
"security": "admin",
"rowsperpage" : 10,

"database": {
    "connection": "mysql",
    "sql"       : "SELECT * FROM Customers",
    "orderby"   : "CustomerName"}},

"filteritems" : [
    {"item" : "CustomerName", "label" : "客户"},
    {"item" : "City"},
    {"item" : "Country"}],

"sortitems" : [
    {"item" : "CustomerName", "label" : "客户"},
    {"item" : "City"},
    {"item" : "Country"}]
}

AppML 模型属性

元素 描述
"data" 定义模型的平面文件源
"database" 定义模型的数据库源
"filteritems" 定义过滤器限制
"rowsperpage" 定义每页要获取的行数
"security" 定义模型的安全
"sortitems" 定义排序限制

应用程序安全

您必须以“admin”组成员身份登录,才能访问此应用程序

示例

{
"security": "admin",
"database": {
    "connection": "mysql",
    "sql"       : "SELECT * FROM Customers",
    "orderby"   : "CustomerName"}
}

私有模型

您可以在模型中添加自己的私有数据。

此示例建议对数据的限制

示例

"restrictions" : {
    "fname" : {"maxlength": 40},
    "price" : {"max": 999,"min": 100}
    }

模型数据可供服务器应用程序和您的 AppML 控制器使用。

此示例使用模型数据来验证输入

示例

function myController($appml) {
    if ($appml.message == "submit") {
        var price = document.getElementById("price").value;
        if (price < $appml.model.restrictions.price.min) {
            $appml.displayError(15, "价格过低!");
            return;
        }
}

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.