@dcloudio/uni-template-compiler 2.0.2-alpha-3070020230114003 → 2.0.2-alpha-3070020230118001

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,8 @@ const {
5
5
  VAR_ROOT,
6
6
  IDENTIFIER_METHOD,
7
7
  IDENTIFIER_FILTER,
8
- IDENTIFIER_GLOBAL
8
+ IDENTIFIER_GLOBAL,
9
+ METHOD_RENDER_LIST
9
10
  } = require('../../constants')
10
11
 
11
12
  function isMatch (name, forItem, forIndex) {
@@ -19,8 +20,23 @@ function findScoped (path, test, state) {
19
20
  const scoped = state.scoped.find(scoped => {
20
21
  const {
21
22
  forItem,
22
- forIndex
23
+ forIndex,
24
+ path: listPath
23
25
  } = scoped
26
+ const funPath = path.findParent(path =>
27
+ path.isFunctionExpression() &&
28
+ t.isCallExpression(path.parentPath) &&
29
+ path.parentPath.node.callee.name === METHOD_RENDER_LIST
30
+ )
31
+ if (funPath && funPath.parentPath === listPath) {
32
+ // TODO 为兼容历史结构仅在当前 list 父级存在 v-if 返回
33
+ const parent = listPath.findParent(path => path.isFunctionExpression() || path.isConditionalExpression())
34
+ if (parent && parent.isConditionalExpression()) {
35
+ return true
36
+ }
37
+ } else {
38
+ return false
39
+ }
24
40
  let match = false
25
41
  path.traverse({
26
42
  noScope: true,
@@ -136,7 +136,8 @@ module.exports = function traverseRenderList (path, state) {
136
136
  forExtra: getForExtra(forItem, forIndex, path, state),
137
137
  propertyArray: [],
138
138
  declarationArray: [],
139
- renderSlotStatementArray: []
139
+ renderSlotStatementArray: [],
140
+ path
140
141
  }
141
142
 
142
143
  const forState = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-template-compiler",
3
- "version": "2.0.2-alpha-3070020230114003",
3
+ "version": "2.0.2-alpha-3070020230118001",
4
4
  "description": "uni-template-compiler",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -22,5 +22,5 @@
22
22
  "@babel/types": "^7.3.3",
23
23
  "vue-template-compiler": "^2.6.10"
24
24
  },
25
- "gitHead": "bd3d8812cd10b4fa53db0580fa060dfcdb61857b"
25
+ "gitHead": "06377abd15bd44a23c23684855587d30fb662c06"
26
26
  }