提交 76d48e31 编写于 作者: fxy060608's avatar fxy060608

Merge branch 'dev' of https://github.com/dcloudio/uni-app into alpha

...@@ -82,9 +82,9 @@ function processPagesJson (pagesJson, loader = { ...@@ -82,9 +82,9 @@ function processPagesJson (pagesJson, loader = {
}) })
} }
if (Object.keys(uniNVuePages).length) { // 直接挂在 pagesJson 上 if (uniNVuePages.length) { // 直接挂在 pagesJson 上
pagesJson.nvue = { pagesJson.nvue = {
pages: uniNVuePages pages: uniNVuePages.reverse()
} }
if (uniNVueEntryPagePath) { if (uniNVueEntryPagePath) {
pagesJson.nvue.entryPagePath = uniNVueEntryPagePath pagesJson.nvue.entryPagePath = uniNVueEntryPagePath
...@@ -152,9 +152,10 @@ function isValidPage (page, root = '') { ...@@ -152,9 +152,10 @@ function isValidPage (page, root = '') {
// process.UNI_NVUE_ENTRY[pagePath] = path.resolve(process.env.UNI_INPUT_DIR, pagePath + '.nvue') + '?entry' // process.UNI_NVUE_ENTRY[pagePath] = path.resolve(process.env.UNI_INPUT_DIR, pagePath + '.nvue') + '?entry'
// } // }
uniNVuePages[pagePath + '.html'] = { uniNVuePages.push({
'window': page.style || {} 'path': pagePath + '.html',
} 'style': page.style || {}
})
return false return false
} }
...@@ -176,7 +177,7 @@ function getNVueMainJsPath (page) { ...@@ -176,7 +177,7 @@ function getNVueMainJsPath (page) {
process.UNI_ENTRY = {} process.UNI_ENTRY = {}
process.UNI_NVUE_ENTRY = {} process.UNI_NVUE_ENTRY = {}
let uniNVuePages = {} const uniNVuePages = []
function parsePages (pagesJson, pageCallback, subPageCallback) { function parsePages (pagesJson, pageCallback, subPageCallback) {
if (!pagesJson) { if (!pagesJson) {
...@@ -215,7 +216,7 @@ function parseEntry (pagesJson) { ...@@ -215,7 +216,7 @@ function parseEntry (pagesJson) {
process.UNI_NVUE_ENTRY['app-service'] = path.resolve(process.env.UNI_INPUT_DIR, getMainEntry()) process.UNI_NVUE_ENTRY['app-service'] = path.resolve(process.env.UNI_INPUT_DIR, getMainEntry())
} }
uniNVuePages = {} uniNVuePages.length = 0
if (!pagesJson) { if (!pagesJson) {
pagesJson = getPagesJson() // 会检测修改 nvue entry pagesJson = getPagesJson() // 会检测修改 nvue entry
......
...@@ -128,12 +128,14 @@ module.exports = function (pagesJson, userManifestJson) { ...@@ -128,12 +128,14 @@ module.exports = function (pagesJson, userManifestJson) {
const nvuePages = pagesJson.nvue && pagesJson.nvue.pages const nvuePages = pagesJson.nvue && pagesJson.nvue.pages
const nvuePagePaths = Object.keys(nvuePages || {}) if (nvuePages.length) {
if (nvuePagePaths.length) {
const pages = {} const pages = {}
nvuePagePaths.forEach(nvuePagePath => { nvuePages.forEach(({
pages[nvuePagePath] = { path,
'window': parseStyle(pagesJson.nvue.pages[nvuePagePath]['window'] || {}), style
}) => {
pages[path] = {
'window': parseStyle(style),
'nvue': true 'nvue': true
} }
}) })
...@@ -319,7 +321,7 @@ module.exports = function (pagesJson, userManifestJson) { ...@@ -319,7 +321,7 @@ module.exports = function (pagesJson, userManifestJson) {
// networkTimeout // networkTimeout
normalizeNetworkTimeout(appJson) normalizeNetworkTimeout(appJson)
appJson.page = Object.create(null) appJson.page = Object.create(null)
appJson.pages = Object.keys(appJson.nvue.pages).reverse().map(pagePath => { appJson.pages = Object.keys(appJson.nvue.pages).map(pagePath => {
const newPagePath = pagePath.replace('.html', '') const newPagePath = pagePath.replace('.html', '')
appJson.page[newPagePath] = { appJson.page[newPagePath] = {
window: appJson.nvue.pages[pagePath].window, window: appJson.nvue.pages[pagePath].window,
......
...@@ -44,7 +44,9 @@ const pagesJson2AppJson = { ...@@ -44,7 +44,9 @@ const pagesJson2AppJson = {
fromJson && fromJson &&
fromJson.nvue && fromJson.nvue &&
fromJson.nvue.pages && fromJson.nvue.pages &&
fromJson.nvue.pages[page.pagePath + '.html'] fromJson.nvue.pages.find(({
path
}) => path === (page.pagePath + '.html'))
) )
) { ) {
console.error( console.error(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册