-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: framework 文档修改 #2568
Open
Vante520
wants to merge
37
commits into
AlipayDocs:main
Choose a base branch
from
Vante520:feat/framework
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: framework 文档修改 #2568
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
51de2aa
feat: franmework 文档修改
55d95c2
Remove .DS_Store from the repository
681c30e
Remove .DS_Store from the repository
90c78e6
补充修改页面运行机制
9902a7e
Update ACSS 语法参考.md
Vante520 f3f57b0
Update AXML介绍.md
Vante520 2debdab
Update 列表渲染.md
Vante520 c69ad45
Update 引入 SJS.md
Vante520 4e66545
Update 引用.md
Vante520 80772b3
Update 数据绑定.md
Vante520 80e5c12
Update 数据绑定.md
Vante520 74a29b8
Update 模板.md
Vante520 7025543
Update SJS 响应事件.md
Vante520 3dc3246
Update esnext.md
Vante520 b865e8c
Update 基础类库.md
Vante520 dd0ee99
Update 注释.md
Vante520 662694a
Update 语句.md
Vante520 25a390a
Update 运算符.md
Vante520 daa43c8
Update 事件介绍.md
Vante520 42c6dbc
Update 事件对象.md
Vante520 f891676
Update 兼容.md
Vante520 a7ab76d
Update 自定义 tabBar.md
Vante520 34e4115
Update app.json 应用配置.md
Vante520 67b4929
Update 小程序 tabBar、titleBar 多语言配置.md
Vante520 90e1a3a
Update 小程序应用配置介绍.md
Vante520 12a77d5
Update Router.md
Vante520 9701ae1
Update mixins.md
Vante520 c017742
Update 发布自定义组件.md
Vante520 23e9a86
Update 抽象节点.md
Vante520 04ab322
Update 组件对象.md
Vante520 f5c0c5e
Update 组件模板和样式.md
Vante520 f95ebca
Update 组件配置.md
Vante520 c24ecd0
Update 组件间关系.md
Vante520 38cca5f
Update 自定义组件介绍.md
Vante520 2f46d1c
Update 自定义组件常见问题.md
Vante520 bc350ab
Update 自定义组件扩展.md
Vante520 baab8f1
Update 获取更新性能统计信息.md
Vante520 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,48 @@ | ||
`import-sjs` 标签用于将 SJS 脚本文件定义的符号引入当前 AXML 文件,并在表达式中使用。更多关于 SJS 的介绍可查看 [SJS 介绍](https://opendocs.alipay.com/mini/framework/sjs)。 | ||
`<import-sjs>` 标签用于将 SJS 脚本文件定义的符号引入当前 AXML 文件,并在表达式中使用。了解更多关于 SJS 的信息,请访问 [SJS 介绍](https://opendocs.alipay.com/mini/framework/sjs)。 | ||
|
||
```javascript | ||
// util.sjs | ||
export default { | ||
message: 'hello alipay', | ||
getMsg: x => x, | ||
}; | ||
``` | ||
|
||
```html | ||
<!-- page.axml --> | ||
<import-sjs name="util" from="./util.sjs"/> | ||
<view> 使用变量 {{util.message}}</view> | ||
<view> 使用函数 {{util.getMsg(msg)}}</view> | ||
``` | ||
|
||
通过 `<import-sjs />` 标签,只能使用 SJS 通过 `export` 语法导出的符号。并遵循如下规则。 | ||
## 默认导出 | ||
通过 `export default` 导出的 **默认导出** 符号,必须通过 `<import-sjs name="module"/>` 来引入。<br />`import-sjs` 功能标签的 `name` 属性必须是一个合法的标识符 `/^[A-Za-z_][A-Za-z0-9_]*$/`。 | ||
通过 `<import-sjs />` 标签,只能使用 SJS 通过 `export` 语法导出的符号。并遵循以下规则: | ||
|
||
## 默认导出 | ||
通过 `export default` 导出的**默认导出**符号,必须通过 `<import-sjs name="module"/>` 来引入。`import-sjs` 功能标签的 `name` 属性必须是一个合法(满足 `/^[A-Za-z_][A-Za-z0-9_]*$/` 正则规则)的标识符。 | ||
|
||
## 具名导出 | ||
通过 `export const a` 导出的 **具名** 符号,必须通过 `<import-sjs name="{ a }"/>` 来引入。<br />`import-sjs` 功能标签的 `name` 属性满足以下规则 | ||
通过 `export const a` 导出的**具名**符号,必须通过 `<import-sjs name="{ a }"/>` 来引入。`import-sjs` 功能标签的 `name` 属性满足以下规则: | ||
|
||
- 是一个 `Object` 字面量表达式 | ||
- `Object` 的 `key` 和 `value` 均是一个 **标识符** | ||
- 是一个 `Object` 字面量表达式。 | ||
- `Object` 的 `key` 和 `value` 均是一个**标识符**。 | ||
|
||
以下是一个复杂示例: | ||
|
||
```javascript | ||
// helper.sjs | ||
export const a = 1; | ||
export function b() { return 2 } | ||
``` | ||
|
||
```html | ||
<!-- page.axml --> | ||
<import-sjs from="./helper.sjs" name="{ a, b: c }"/> | ||
<import-sjs from="./helper.sjs" name="{ a, b: c }"/> | ||
<view>{{ c() }}:{{a}}:{{ b }}</view> | ||
<!-- 等价于 --> | ||
<view>{{ 2 }}:{{ 1 }}:{{ undefined }}</view> | ||
``` | ||
|
||
需要注意: | ||
需要注意的是: | ||
|
||
- 如果 `name` 出现 **默认导出** 的同名,会在编译期直接覆盖(即不论 `<import-sjs>` 标签的顺序,被覆盖的 _默认导出_ 符号在整个 AXML 中均不可访问)。 | ||
- 如果 `name` 出现 **具名导出** 的同名,会直接抛出编译异常。 | ||
- 如果 `name` 出现**默认导出**的同名,会在编译期直接覆盖(即`<import-sjs>` 标签的顺序无关紧要,被覆盖的*默认导出*符号在整个 AXML 中均不可访问)。 | ||
- 如果 `name` 出现**具名导出**的同名,会直接抛出编译异常。 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{{ message }}
保留花括号里面空格