diff --git a/content/computer_sci/coding_knowledge/web/html_double_curly_braces.md b/content/computer_sci/coding_knowledge/web/html_double_curly_braces.md new file mode 100644 index 000000000..0cd59f989 --- /dev/null +++ b/content/computer_sci/coding_knowledge/web/html_double_curly_braces.md @@ -0,0 +1,23 @@ +--- +title: HTML double curly braces +tags: + - html + - coding-language + - web +date: 2024-03-13 +--- +在 HTML 中,**双花括号 {{}}** 并不是原生的 HTML 语法,而是一种用于模板引擎或前端框架的标记。 + + **模板引擎和数据绑定**: + + - 双花括号通常用于模板引擎,例如 **Angular**、**Vue.js** 或 **Handlebars**。 + - 在这些框架中,您可以在 HTML 中使用双花括号来插入动态数据。例如: + + ```html +
欢迎来到 {{ websiteName }}!
+ ``` + + 这里的 `websiteName` 是一个变量,它会被实际的值替代。 + +> [!abstract] +> 总之,双花括号是一种强大的工具,用于将动态数据嵌入到 HTML 中,使网页更具交互性和实用性。 \ No newline at end of file