forked from dcloudio/uni-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/dcloudio/uni-app into v3
- Loading branch information
Showing
21 changed files
with
497 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const path = require('path') | ||
const babel = require('rollup-plugin-babel') | ||
const alias = require('rollup-plugin-alias') | ||
const uglify = require('rollup-plugin-uglify') | ||
module.exports = { | ||
input: 'src/core/runtime/web-view/index.js', | ||
output: { | ||
name: 'uni', | ||
file: `dist/uni.webview.1.5.2.js`, | ||
format: 'umd' | ||
}, | ||
plugins: [ | ||
alias({ | ||
'uni-platforms': path.resolve(__dirname, '../src/platforms') | ||
}), | ||
babel(), | ||
uglify.uglify({ | ||
output: { | ||
ascii_only: true | ||
} | ||
}) | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 63 additions & 3 deletions
66
packages/vue-cli-plugin-hbuilderx/packages/webpack-uni-nvue-loader/lib/template.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,67 @@ | ||
const path = require('path') | ||
|
||
const { | ||
removeExt, | ||
normalizePath, | ||
getPagesJson | ||
} = require('@dcloudio/uni-cli-shared') | ||
|
||
const { | ||
normalizeNodeModules | ||
} = require('@dcloudio/webpack-uni-mp-loader/lib/shared') | ||
|
||
const SCROLLER_COMPONENTS = [ | ||
'list', | ||
'scroller', | ||
'scroll-view', | ||
'waterfall' | ||
] | ||
|
||
module.exports = function(content) { | ||
this.cacheable && this.cacheable() | ||
if (content.indexOf('recycle-list') === -1) { | ||
return `<scroll-view :scroll-y="true" :enableBackToTop="true" bubble="true" style="flex-direction:column">${content}</scroll-view>` | ||
const source = content.trim() | ||
|
||
if (SCROLLER_COMPONENTS.find(name => source.indexOf('<' + name) === 0)) { | ||
return content | ||
} | ||
return content | ||
if (source.indexOf('<recycle-list') !== -1) { | ||
return content | ||
} | ||
|
||
let resourcePath = normalizeNodeModules( | ||
removeExt(normalizePath(path.relative(process.env.UNI_INPUT_DIR, this.resourcePath))) | ||
) | ||
|
||
if ( | ||
!process.UNI_NVUE_ENTRY[resourcePath] && | ||
this._module.issuer && | ||
this._module.issuer.issuer | ||
) { | ||
// <template src=""/> | ||
resourcePath = normalizeNodeModules( | ||
removeExt(normalizePath(path.relative(process.env.UNI_INPUT_DIR, this._module.issuer.issuer.resource))) | ||
) | ||
} | ||
|
||
if (!process.UNI_NVUE_ENTRY[resourcePath]) { | ||
return content | ||
} | ||
// 暂时实时读取配置信息,查找是否 disableScroll | ||
const appJson = getPagesJson() | ||
if (!appJson.nvue || !appJson.nvue.pages) { | ||
return content | ||
} | ||
const pagePath = resourcePath + '.html' | ||
const pageJson = appJson.nvue.pages.find(page => page.path === pagePath) | ||
if (!pageJson) { | ||
return content | ||
} | ||
Object.assign(appJson.globalStyle, appJson.globalStyle['app-plus'] || {}) | ||
Object.assign(pageJson.style, pageJson.style['app-plus'] || {}) | ||
const pageJsonStyle = Object.assign(appJson.globalStyle, pageJson.style) | ||
if (pageJsonStyle.disableScroll === true) { | ||
return content | ||
} | ||
|
||
return `<scroll-view :scroll-y="true" :enableBackToTop="true" bubble="true" style="flex-direction:column">${content}</scroll-view>` | ||
} |
Oops, something went wrong.