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

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

...@@ -19,17 +19,25 @@ const service = new Service(process.env.VUE_CLI_CONTEXT || process.cwd(), { ...@@ -19,17 +19,25 @@ const service = new Service(process.env.VUE_CLI_CONTEXT || process.cwd(), {
// 删除 cache 目录 // 删除 cache 目录
del.sync(['node_modules/.cache']) del.sync(['node_modules/.cache'])
let entry = './lib/' + process.env.UNI_PLATFORM + '/main.js'
if (process.env.UNI_PLATFORM === 'h5' && process.env.UNI_UI === 'true') {
entry = './lib/' + process.env.UNI_PLATFORM + '/ui.js'
}
service.run('build', { service.run('build', {
name: 'index', name: 'index',
watch: process.env.UNI_WATCH === 'true', watch: process.env.UNI_WATCH === 'true',
target: 'lib', target: 'lib',
formats: process.env.UNI_WATCH === 'true' ? 'umd' : 'umd-min', formats: process.env.UNI_WATCH === 'true' ? 'umd' : 'umd-min',
entry: './lib/' + process.env.UNI_PLATFORM + '/main.js' entry
}).then(function () { }).then(function () {
generateApiManifest( if (process.env.UNI_UI !== 'true') {
JSON.parse(JSON.stringify(process.UNI_SERVICE_API_MANIFEST)), generateApiManifest(
JSON.parse(JSON.stringify(process.UNI_SERVICE_API_PROTOCOL)) JSON.parse(JSON.stringify(process.UNI_SERVICE_API_MANIFEST)),
) JSON.parse(JSON.stringify(process.UNI_SERVICE_API_PROTOCOL))
)
}
}).catch(err => { }).catch(err => {
error(err) error(err)
process.exit(1) process.exit(1)
......
...@@ -6,9 +6,15 @@ const pkgPath = resolve('package.json') ...@@ -6,9 +6,15 @@ const pkgPath = resolve('package.json')
const webpackConfig = require('./webpack.config.js') const webpackConfig = require('./webpack.config.js')
let outputDir = resolve('./packages/uni-' + process.env.UNI_PLATFORM + '/dist')
if (process.env.UNI_PLATFORM === 'h5' && process.env.UNI_UI === 'true') {
outputDir = resolve('./packages/uni-' + process.env.UNI_PLATFORM + '-ui/dist')
}
module.exports = { module.exports = {
publicPath: '/', publicPath: '/',
outputDir: resolve('./packages/uni-' + process.env.UNI_PLATFORM + '/dist'), outputDir,
lintOnSave: true, // or error lintOnSave: true, // or error
runtimeCompiler: false, runtimeCompiler: false,
transpileDependencies: [], transpileDependencies: [],
......
import {
canIUse
} from 'uni-core/service/api/base/can-i-use'
import {
upx2px
} from 'uni-core/service/api/base/upx2px'
import {
getLocation
} from 'uni-platform/service/api/location/get-location'
import {
onCompassChange,
stopCompass
} from 'uni-platform/service/api/device/compass'
import {
getSystemInfoSync
} from 'uni-platform/service/api/device/get-system-info'
// TODO route
export default {
canIUse,
upx2px,
getLocation,
onCompassChange,
stopCompass,
getSystemInfoSync
}
...@@ -3,8 +3,18 @@ import Vue from 'vue' ...@@ -3,8 +3,18 @@ import Vue from 'vue'
// 使用白名单过滤(前期有一批自定义组件使用了 uni-) // 使用白名单过滤(前期有一批自定义组件使用了 uni-)
import tags from 'uni-helpers/tags' import tags from 'uni-helpers/tags'
import 'uni-core/view/index.css'
import uni from './ui-api.js'
import {
processEvent
} from 'uni-core/view/plugins/events'
const oldIsReservedTag = Vue.config.isReservedTag const oldIsReservedTag = Vue.config.isReservedTag
global.uni = uni
Vue.config.isReservedTag = function (tag) { Vue.config.isReservedTag = function (tag) {
return tags.indexOf(tag) !== -1 || oldIsReservedTag(tag) return tags.indexOf(tag) !== -1 || oldIsReservedTag(tag)
} }
...@@ -21,4 +31,24 @@ Vue.config.getTagNamespace = function (tag) { ...@@ -21,4 +31,24 @@ Vue.config.getTagNamespace = function (tag) {
} }
return oldGetTagNamespace(tag) || false return oldGetTagNamespace(tag) || false
} }
const findUniTarget = function ($event, $el) {
let target = $event.target
for (; target && target !== $el; target = target.parentNode) {
if (target.tagName && target.tagName.indexOf('UNI-') === 0) {
break
}
}
return target
}
Vue.prototype.$handleEvent = function ($event) {
if ($event instanceof Event) { // 未处理的 event 对象 需要对 target 校正及包装
// 查找 uniTarget
const target = findUniTarget($event, this.$el)
$event = processEvent.call(this, $event.type, $event, {}, target || $event.target, $event.currentTarget)
}
return $event
}
require('uni-components') require('uni-components')
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
"lint": "eslint --fix --config package.json --ext .js --ext .vue --ignore-path .eslintignore build src", "lint": "eslint --fix --config package.json --ext .js --ext .vue --ignore-path .eslintignore build src",
"lint:cli": "eslint --fix --config package.json --ignore-path .eslintignore packages/uni-cli-shared packages/uni-template-compiler \"packages/vue-cli-*/**/*.js\" \"packages/webpack-uni-*/**/*.js\"", "lint:cli": "eslint --fix --config package.json --ignore-path .eslintignore packages/uni-cli-shared packages/uni-template-compiler \"packages/vue-cli-*/**/*.js\" \"packages/webpack-uni-*/**/*.js\"",
"dev:h5": "npm run lint && cross-env NODE_ENV=production UNI_WATCH=true UNI_PLATFORM=h5 node build/build.js", "dev:h5": "npm run lint && cross-env NODE_ENV=production UNI_WATCH=true UNI_PLATFORM=h5 node build/build.js",
"build:h5": "npm run lint && cross-env NODE_ENV=production UNI_WATCH=false UNI_PLATFORM=h5 node build/build.js", "build:h5": "npm run lint && cross-env NODE_ENV=production UNI_WATCH=false UNI_PLATFORM=h5 node build/build.js",
"build:h5:ui": "cross-env NODE_ENV=production UNI_WATCH=false UNI_PLATFORM=h5 UNI_UI=true node build/build.js",
"build:app-plus": "cross-env UNI_PLATFORM=app-plus rollup -c build/rollup.config.mp.js", "build:app-plus": "cross-env UNI_PLATFORM=app-plus rollup -c build/rollup.config.mp.js",
"build:app:all": "npm run lint && npm run build:app:nvue && npm run build:app:legacy", "build:app:all": "npm run lint && npm run build:app:nvue && npm run build:app:legacy",
"build:app:nvue": "cross-env UNI_PLATFORM=app-plus-nvue rollup -c build/rollup.config.app.js", "build:app:nvue": "cross-env UNI_PLATFORM=app-plus-nvue rollup -c build/rollup.config.app.js",
......
此差异已折叠。
因为 它太大了无法显示 source diff 。你可以改为 查看blob
{
"name": "@dcloudio/uni-h5-ui",
"version": "0.0.1",
"description": "uni-app h5 ui",
"main": "dist/index.umd.min.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "fxy060608",
"license": "Apache-2.0"
}
...@@ -50,7 +50,7 @@ module.exports = (api, options, rootOptions) => { ...@@ -50,7 +50,7 @@ module.exports = (api, options, rootOptions) => {
'babel-plugin-import': '^1.11.0' 'babel-plugin-import': '^1.11.0'
}, },
browserslist: [ browserslist: [
'Android >= 4.4', 'Android >= 4',
'ios >= 8' 'ios >= 8'
] ]
} }
......
...@@ -4,7 +4,7 @@ module.exports = function (errors) { ...@@ -4,7 +4,7 @@ module.exports = function (errors) {
runByHBuilderX runByHBuilderX
} = require('@dcloudio/uni-cli-shared') } = require('@dcloudio/uni-cli-shared')
if (runByHBuilderX) { if (runByHBuilderX) {
console.log(stringify(errors)) console.log('WARNING: ' + stringify(errors))
} else { } else {
console.warn(stringify(errors)) console.warn(stringify(errors))
} }
......
...@@ -177,9 +177,8 @@ module.exports = function (pagesJson, userManifestJson) { ...@@ -177,9 +177,8 @@ module.exports = function (pagesJson, userManifestJson) {
// 允许内联播放视频 // 允许内联播放视频
manifestJson.plus.allowsInlineMediaPlayback = true manifestJson.plus.allowsInlineMediaPlayback = true
// 安全区配置
if (appJson.tabBar && appJson.tabBar.list && appJson.tabBar.list.length) { if (appJson.tabBar && appJson.tabBar.list && appJson.tabBar.list.length) {
// 仅包含 tabBar 的时候才配置 // 安全区配置 仅包含 tabBar 的时候才配置
if (!manifestJson.plus.safearea) { if (!manifestJson.plus.safearea) {
manifestJson.plus.safearea = { manifestJson.plus.safearea = {
background: appJson.tabBar.backgroundColor || '#FFFFFF', background: appJson.tabBar.backgroundColor || '#FFFFFF',
...@@ -188,6 +187,15 @@ module.exports = function (pagesJson, userManifestJson) { ...@@ -188,6 +187,15 @@ module.exports = function (pagesJson, userManifestJson) {
} }
} }
} }
} else {
// "render": "always"
if (!manifestJson.plus.launchwebview) {
manifestJson.plus.launchwebview = {
'render': 'always'
}
} else if (!manifestJson.plus.launchwebview.render) {
manifestJson.plus.launchwebview.render = 'always'
}
} }
let flexDir = false let flexDir = false
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
"alwaysShowBeforeRender":true "alwaysShowBeforeRender":true
}, },
"popGesture": "close", "popGesture": "close",
"launchwebview": { "launchwebview": {}
"render": "always"
}
} }
} }
...@@ -37,7 +37,10 @@ function hasOwn (obj, key) { ...@@ -37,7 +37,10 @@ function hasOwn (obj, key) {
return hasOwnProperty.call(obj, key) return hasOwnProperty.call(obj, key)
} }
function parseStyle (style = {}, root = '') { function parseStyle (style = {}, root = '') {
// TODO pages.json 触发了两次,需要排查
style = JSON.parse(JSON.stringify(style))
let platformStyle = {} let platformStyle = {}
Object.keys(style).forEach(name => { Object.keys(style).forEach(name => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册