# 构成

## 不同类型文件

1. `.json` 后缀的 `JSON` 配置文件，JSON 是一种数据格式，并不是编程语言，在小程序中，JSON扮演的静态配置的角色。
2. `.wxml` 后缀的 `WXML` 模板文件， 在小程序中也有同样的角色，其中 `WXML` 充当的就是类似 `HTML` 的角色。打开 `pages/index/index.wxml`，你会看到类似于html的代码
3. `.wxss` 后缀的 `WXSS` 样式文件， `WXSS` 具有 `CSS` 大部分的特性，小程序在 `WXSS` 也做了一些扩充和修改。
4. `.js` 后缀的 `JS` 脚本逻辑文件， 一个服务仅仅只有界面展示是不够的，还需要和用户做交互：响应用户的点击、获取用户的位置等等。在小程序里边，我们就通过编写 `JS` 脚本文件来处理用户的操作。

## 目录结构

| 文件       | 必需 | 作用       |
| -------- | -- | -------- |
| app.js   | 是  | 小程序逻辑    |
| app.json | 是  | 小程序公共配置  |
| app.wxss | 否  | 小程序公共样式表 |

一个小程序页面由四个文件组成，分别是：

| 文件类型 | 必需 | 作用    |
| ---- | -- | ----- |
| js   | 是  | 页面逻辑  |
| wxml | 是  | 页面结构  |
| json | 否  | 页面配置  |
| wxss | 否  | 页面样式表 |

**注意：为了方便开发者减少配置项，描述页面的四个文件必须具有相同的路径与文件名。**

* index.js
* index.wxml
* index.json
* index.wxss


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.luckydesigner.space/wechat/gou-cheng.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
