pawa-ssr 1.0.4 → 1.0.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/power.js +6 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pawa-ssr",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "pawajs ssr libary",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/power.js CHANGED
@@ -77,7 +77,8 @@ export const For=(el,attr)=>{
77
77
  return
78
78
  }
79
79
  el._running=true
80
- const value=attr.value
80
+ try {
81
+ const value=attr.value
81
82
  const split=value.split(' in ')
82
83
  const arrayName=split[1]
83
84
  const arrayItems=split[0].split(',')
@@ -88,10 +89,10 @@ export const For=(el,attr)=>{
88
89
  array.forEach((item,index)=>{
89
90
  const context=el._context
90
91
  const itemContext = {
91
- [arrayItem]: item,
92
92
  [indexes]: index,
93
93
  ...context
94
94
  }
95
+ itemContext[arrayItem]=item
95
96
  console.log(itemContext,arrayItem,item,array)
96
97
  const newElement=el.cloneNode(true)
97
98
  newElement.removeAttribute('server-for')
@@ -106,4 +107,7 @@ export const For=(el,attr)=>{
106
107
  })
107
108
  }
108
109
  el.remove()
110
+ } catch (error) {
111
+ console.error(error.message,error.stack)
112
+ }
109
113
  }