Commit 15d38242 authored by JingChao's avatar JingChao

hmap跟新

parent d245b746
...@@ -23,24 +23,25 @@ For a detailed explanation on how things work, check out the [guide](http://vuej ...@@ -23,24 +23,25 @@ For a detailed explanation on how things work, check out the [guide](http://vuej
### 文件命名规范 ### 文件命名规范
1. 文件夹全部采用PascalCase命名法,即每个单词首字母大写 1. 文件夹全部采用驼峰命名法,即首字母小写后面每个单词首字母大写
2. 文件名全部采用PascalCase命名法,如 **UserInfo.vue,UserInfoDetail.vue**, 2. 文件名全部使用小写字母,单词与单词之间采用**-**连接,如 **user-info.vue,user-info-detail.vue**,
3. 路由的注册 `import` 语句后的单词采用 Pascal命名法,所有单词的首字母大写,其余字母小写,单词与单词之间不使用任何符号风格。如 3. 路由的注册 `import` 语句后的单词采用 Pascal命名法,所有单词的首字母大写,其余字母小写,单词与单词之间不使用任何符号风格。如
路由全部按需加载,按照如下写法,路由后面的单词为打包后的js名称,按照模块进行分割打包,注意不要全部一样,那样没有任何意义
```javascript ```javascript
import HomeManager from '@/pages/HomeManager/HomeManager' const HomeManager = resolve => require.ensure([], () => { resolve(require('@/pages/homeManager/home-manager')) }, 'home')
import LoadMore from '@/pages/LoadMore/LoadMore' const LoadMore = resolve => require.ensure([], () => { resolve(require('@/pages/loadMore/load-more')) }, 'loadMore')
import UserInfo from '@/pages/UserInfo/UserInfo' const UserInfo = resolve => require.ensure([], () => { resolve(require('@/pages/userInfo/user-info')) }, 'userInfo')
import UserInfoDetail from '@/pages/UserInfo/UserInfoDetail' const UserInfoDetail = resolve => require.ensure([], () => { resolve(require('@/pages/userInfo/user-info-detail')) }, 'userInfo')
``` ```
4. 实际路由注册需安照如下写法,`path``/tab/文件名`,`/tab`是否保留按照是否存在tab页的情况而定。`component`后接的单词需和`import`的单词保持一致,`name`后接的单词也需和`import`的单词保持一致 4. 实际路由注册需安照如下写法,`path``/tab/文件名`,`/tab`是否保留视实际情况而定。`component`后接的单词需和`import`的单词保持一致,`name`后接的单词也需和`import`的单词保持一致
```javascript ```javascript
{path: "/tab/HomeManager", component: HomeManager, name: 'HomeManager', meta: {keepAlive: true}}, {path: "/tab/home-manager", component: HomeManager, name: 'HomeManager', meta: {keepAlive: true}},
{path: '/tab/LoadMore', component: LoadMore, name: 'LoadMore', meta: {keepAlive: true}}, {path: '/tab/load-more', component: LoadMore, name: 'LoadMore', meta: {keepAlive: true}},
{path: '/tab/UserInfo', component: UserInfo, name: 'UserInfo', meta: {keepAlive: true}}, {path: '/tab/user-info', component: UserInfo, name: 'UserInfo', meta: {keepAlive: true}},
``` ```
...@@ -72,7 +72,7 @@ module.exports = { ...@@ -72,7 +72,7 @@ module.exports = {
* Source Maps * Source Maps
*/ */
productionSourceMap: true, productionSourceMap: false,
// https://webpack.js.org/configuration/devtool/#production // https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map', devtool: '#source-map',
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-status-bar-style" content="black">
<script type="text/javascript" src="./static/vuePlatform.js"></script> <script type="text/javascript" src="./static/vuePlatform.js"></script>
<script type="text/javascript" src="./static/prototype.js"></script>
<script type="text/javascript" src="../../cordova.js"></script>
<title>车租易</title> <title>车租易</title>
</head> </head>
<body> <body>
......
...@@ -19,7 +19,7 @@ export function timeout (time) { ...@@ -19,7 +19,7 @@ export function timeout (time) {
* @param {any} msg 信息 * @param {any} msg 信息
*/ */
export function assert (condition, msg) { export function assert (condition, msg) {
if (!condition) throw new Error(`[hips] ${msg}`) if (!condition) throw new Error(`[hls-ui] ${msg}`)
} }
/** /**
...@@ -50,3 +50,118 @@ export function detectOS () { ...@@ -50,3 +50,118 @@ export function detectOS () {
return 'other' return 'other'
} }
} }
/**
* 取URL上的参数
* @param {String} param 参数名
* @return {String}
*/
export function getUrlParam (param) {
const result = window.location.href.match(new RegExp('(\\?|&)' + param + '(\\[\\])?=([^&#]*)'))
return result ? result[3] : undefined
}
/**
* 动态插入 script to html
* @param url
* @param callback
*/
export function createScript (url, callback) {
const oScript = document.createElement('script')
oScript.type = 'text/javascript'
oScript.async = true
oScript.src = url
/**
* IE6/7/8 -- onreadystatechange
* IE9/10 -- onreadystatechange, onload
* Firefox/Chrome/Opera -- onload
*/
const isIE = !-[1,] // eslint-disable-line
if (isIE) {
// 判断IE8及以下浏览器
oScript.onreadystatechange = function () {
if (this.readyState === 'loaded' || this.readyState === 'complete') {
callback && callback()
}
}
} else {
// IE9及以上浏览器,Firefox,Chrome,Opera
oScript.onload = function () {
callback && callback()
}
}
document.body.appendChild(oScript)
}
export function range (num, min, max) {
return Math.min(Math.max(num, min), max)
}
function trimExtraChar (value, char, regExp) {
const index = value.indexOf(char)
if (index === -1) {
return value
}
if (char === '-' && index !== 0) {
return value.slice(0, index)
}
return value.slice(0, index + 1) + value.slice(index).replace(regExp, '')
}
export function formatNumber (value, allowDot) {
if (value) {
if (allowDot) {
value = trimExtraChar(value, '.', /\./g)
} else {
value = value.split('.')[0]
}
value = trimExtraChar(value, '-', /-/g)
const regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g
return value.replace(regExp, '')
}
}
export function isDef (val) {
return val !== undefined && val !== null && val !== ''
}
export function isUndefined (value) {
return Object.prototype.toString.call(value) === '[object Undefined]'
}
export function isString (value) {
return Object.prototype.toString.call(value) === '[object String]'
}
export function isNumber (value) {
return Object.prototype.toString.call(value) === '[object Number]'
}
export function isBoolean (value) {
return Object.prototype.toString.call(value) === '[object Boolean]'
}
export function isNull (value) {
return Object.prototype.toString.call(value) === '[object Null]'
}
export function isObject (value) {
return Object.prototype.toString.call(value) === '[object Object]'
}
export function isFunction (value) {
return Object.prototype.toString.call(value) === '[object Function]'
}
export function isArray (value) {
return Object.prototype.toString.call(value) === '[object Array]'
}
export function isDate (value) {
return Object.prototype.toString.call(value) === '[object Date]'
}
export function isRegExp (value) {
return Object.prototype.toString.call(value) === '[object RegExp]'
}
...@@ -3841,18 +3841,6 @@ he@1.2.x, he@^1.1.0: ...@@ -3841,18 +3841,6 @@ he@1.2.x, he@^1.1.0:
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
"hls-easy-ui@https://hel.hand-china.com/easyUI/hls-easy-ui.git":
version "0.0.4"
resolved "https://hel.hand-china.com/easyUI/hls-easy-ui.git#5f7b05e25ed733d273c1efa516e493b01ec75e04"
dependencies:
autosize "^3.0.20"
better-scroll "^1.10.3"
fastclick "https://hel.hand-china.com/easyUI/fastclick.git"
vue "^2.5.2"
vue-lazyload "1.2.3"
vue-router "^3.0.1"
vux "^2.9.2"
hmac-drbg@^1.0.0: hmac-drbg@^1.0.0:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment