提交 970a999f 编写于 作者: Q qiang

Merge branch 'dev' into alpha

......@@ -10,10 +10,10 @@ const {
module.exports = function parseComponent (el) {
// 需要把自定义组件的 attrs, props 全干掉
if (el.tag && isComponent(el.tag)) {
// 仅保留 ID
// 仅保留 id、ID、data
el.attrs && (el.attrs = el.attrs.filter(attr => {
const name = attr.name
return name === ID || name.indexOf('data-') === 0
return name === 'id' || name === ID || name.indexOf('data-') === 0
}))
}
}
}
......@@ -2,16 +2,11 @@ const {
hasOwn
} = require('../util')
const {
getTagName
} = require('../../h5')
const tags = require('@dcloudio/uni-cli-shared/lib/tags')
const tags = require('@dcloudio/uni-cli-shared/lib/tags')
// 仅限 view 层
module.exports = function parseTag (el) {
el.tag = getTagName(el.tag)
if (el.tag.indexOf('v-uni-') !== 0 && hasOwn(tags, el.tag)) {
el.tag = 'v-uni-' + el.tag
}
}
}
......@@ -79,7 +79,7 @@ module.exports = function (source) {
const isWin = /^win/.test(process.platform)
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
if(options.compilerOptions){
if(!options.compilerOptions){
options.compilerOptions = {}
}
options.compilerOptions.autoComponentResourcePath = normalizePath(resourcePath)
......
......@@ -82,13 +82,15 @@ module.exports = function (appJson, manifestJson, {
// 删除首页 style 中的 uni-app 配置(不注入 app-view.js)
delete manifestJson.plus.launchwebview['uni-app']
if (appJson.page[appJson.entryPagePath].nvue) { // 首页是 nvue
const entryPagePath = appJson.entryPagePath
if (appJson.page[entryPagePath].nvue) { // 首页是 nvue
manifestJson.launch_path = '' // 首页地址为空
manifestJson.plus.launchwebview.uniNView = {
path: appJson.entryPagePath + '.js' + (appJson.entryPageQuery || '')
path: entryPagePath + '.js' + (appJson.entryPageQuery || '')
}
if (manifestJson.plus.tabBar) {
manifestJson.plus.tabBar.child = ['lauchwebview']
const tabBar = manifestJson.plus.tabBar
if (isTabBarPage(entryPagePath, tabBar.list)) {
tabBar.child = ['lauchwebview']
}
} else {
manifestJson.plus.launch_path = '__uniappview.html' // 首页地址固定
......@@ -102,4 +104,4 @@ module.exports = function (appJson, manifestJson, {
manifest.content = JSON.stringify(manifest.content)
delete appJson.nvue
return [manifest, definePages(appJson), appConfigService(appJson)]
}
}
const TITLEBAR_HEIGHT = 44
function getStatusbarHeight () {
// 横屏时 iOS 获取的状态栏高度错误,进行纠正
return plus.navigator.isImmersedStatusbar() ? Math.round(plus.os.name === 'iOS' ? plus.navigator.getSafeAreaInsets().top : plus.navigator.getStatusbarHeight()) : 0
}
function getNavigationBarHeight () {
const webview = plus.webview.currentWebview()
let style = webview.getStyle()
style = style && style.titleNView
if (style && style.type === 'default') {
return TITLEBAR_HEIGHT + getStatusbarHeight()
}
return 0
}
function getFixed ($el) {
let fixed
while ($el) {
const style = getComputedStyle($el)
const transform = style.transform || style.webkitTransform
fixed = transform && transform !== 'none' ? false : fixed
fixed = style.position === 'fixed' ? true : fixed
$el = $el.parentElement
}
return fixed
}
export default {
name: 'Native',
data () {
......@@ -28,10 +57,13 @@ export default {
const rect = (this.$refs.container || this.$el).getBoundingClientRect()
this.hidden = rect.width === 0 || rect.height === 0
if (!this.hidden) {
['top', 'left', 'width', 'height'].forEach(key => {
const position = this.position
position.position = getFixed(this.$el) ? 'absolute' : 'static'
const keys = ['top', 'left', 'width', 'height']
keys.forEach(key => {
let val = rect[key]
val = key === 'top' ? val + (document.documentElement.scrollTop || document.body.scrollTop || 0) : val
this.position[key] = val + 'px'
val = key === 'top' ? val + (position.position === 'static' ? (document.documentElement.scrollTop || document.body.scrollTop || 0) : getNavigationBarHeight()) : val
position[key] = val + 'px'
})
}
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册