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

feat(uni-h5-ui): init

上级 c66cfd4d
......@@ -19,17 +19,25 @@ const service = new Service(process.env.VUE_CLI_CONTEXT || process.cwd(), {
// 删除 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', {
name: 'index',
watch: process.env.UNI_WATCH === 'true',
target: 'lib',
formats: process.env.UNI_WATCH === 'true' ? 'umd' : 'umd-min',
entry: './lib/' + process.env.UNI_PLATFORM + '/main.js'
entry
}).then(function () {
generateApiManifest(
JSON.parse(JSON.stringify(process.UNI_SERVICE_API_MANIFEST)),
JSON.parse(JSON.stringify(process.UNI_SERVICE_API_PROTOCOL))
)
if (process.env.UNI_UI !== 'true') {
generateApiManifest(
JSON.parse(JSON.stringify(process.UNI_SERVICE_API_MANIFEST)),
JSON.parse(JSON.stringify(process.UNI_SERVICE_API_PROTOCOL))
)
}
}).catch(err => {
error(err)
process.exit(1)
......
......@@ -6,9 +6,15 @@ const pkgPath = resolve('package.json')
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 = {
publicPath: '/',
outputDir: resolve('./packages/uni-' + process.env.UNI_PLATFORM + '/dist'),
outputDir,
lintOnSave: true, // or error
runtimeCompiler: false,
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,14 @@ import Vue from 'vue'
// 使用白名单过滤(前期有一批自定义组件使用了 uni-)
import tags from 'uni-helpers/tags'
import 'uni-core/view/index.css'
import uni from './ui-api.js'
const oldIsReservedTag = Vue.config.isReservedTag
global.uni = uni
Vue.config.isReservedTag = function (tag) {
return tags.indexOf(tag) !== -1 || oldIsReservedTag(tag)
}
......@@ -21,4 +27,5 @@ Vue.config.getTagNamespace = function (tag) {
}
return oldGetTagNamespace(tag) || false
}
require('uni-components')
......@@ -6,7 +6,8 @@
"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\"",
"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": "npm run lint && 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: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",
......
此差异已折叠。
因为 它太大了无法显示 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"
}
......@@ -37,7 +37,10 @@ function hasOwn (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 = {}
Object.keys(style).forEach(name => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册