vaderjs 1.9.8 → 1.9.9
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.
- package/main.js +12 -6
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -218,13 +218,12 @@ async function generateApp() {
|
|
|
218
218
|
fs.mkdirSync(path.join(process.cwd() + '/dist', path.dirname(r)), { recursive: true })
|
|
219
219
|
let params = routes.match(route).params || {}
|
|
220
220
|
let base = routes.match(route)
|
|
221
|
-
let paramIndexes = []
|
|
222
|
-
console.log(base)
|
|
221
|
+
let paramIndexes = []
|
|
223
222
|
for (let param in params) {
|
|
224
223
|
let routes = base.pathname.split('/')
|
|
225
224
|
let index = routes.indexOf('[' + param + ']')
|
|
226
225
|
paramIndexes.push(index)
|
|
227
|
-
}
|
|
226
|
+
}
|
|
228
227
|
|
|
229
228
|
// dont return
|
|
230
229
|
|
|
@@ -233,7 +232,15 @@ async function generateApp() {
|
|
|
233
232
|
`
|
|
234
233
|
let route = window.location.pathname.split('/').filter(Boolean)
|
|
235
234
|
let params = {
|
|
236
|
-
|
|
235
|
+
// get index tehn do route[index]
|
|
236
|
+
${Object.keys(params).map((param, i) => {
|
|
237
|
+
if (paramIndexes[i] !== -1) {
|
|
238
|
+
var r_copy = r;
|
|
239
|
+
r_copy = r_copy.split('/').filter(Boolean)
|
|
240
|
+
var index = paramIndexes[i] - 1
|
|
241
|
+
return `${param}: route[${index}]`
|
|
242
|
+
}
|
|
243
|
+
}).join(',\n')}
|
|
237
244
|
}
|
|
238
245
|
|
|
239
246
|
\n${code}
|
|
@@ -324,8 +331,7 @@ async function generateApp() {
|
|
|
324
331
|
|
|
325
332
|
function handleFiles() {
|
|
326
333
|
return new Promise(async (resolve, reject) => {
|
|
327
|
-
try {
|
|
328
|
-
console.log(Glob)
|
|
334
|
+
try {
|
|
329
335
|
let glob = new Glob('public/**/*')
|
|
330
336
|
for await (var i of glob.scan()) {
|
|
331
337
|
let file = i
|