Skip to content
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: wx:key #1462

Merged
merged 9 commits into from May 15, 2024
Merged

feat: wx:key #1462

merged 9 commits into from May 15, 2024

Conversation

wenwenhua
Copy link
Collaborator

No description provided.

@@ -6,6 +6,14 @@ const isValidIdentifierStr = require('../../../utils/is-valid-identifier-str')
const { parseMustacheWithContext, stringifyWithResolveComputed } = require('../../../template-compiler/compiler')
const normalize = require('../../../utils/normalize')

function convertKeyReact ({ value }, { el }) {
const itemName = el.attrsMap['wx:for-item'] || 'item'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

考虑放在生成jsx的逻辑中处理

@@ -1751,6 +1751,13 @@ function postProcessFor (el) {

function postProcessForReact (el) {
if (el.for) {
if (el.for.key) {
addExp(el, `this.__getWxKey(${el.for.item}, '${el.for.key}')`, false, 'key')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

el.for.item||'item'

@hiyuki hiyuki merged commit 4bcf20b into feat-react May 15, 2024
4 checks passed
@hiyuki hiyuki deleted the feat-react-wxkey branch May 15, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants