Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hls-webapp-cli
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
heasy
hls-webapp-cli
Commits
affc9754
Commit
affc9754
authored
Aug 26, 2020
by
JingChao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web跟新
parent
8632975d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
127 additions
and
24 deletions
+127
-24
README.md
template/README.md
+10
-9
index.html
template/index.html
+0
-1
index.js
template/src/common/utils/index.js
+116
-1
index.js
template/src/router/index.js
+1
-1
yarn.lock
template/yarn.lock
+0
-12
No files found.
template/README.md
View file @
affc9754
...
...
@@ -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,UserInfoD
etail.vue**
,
2.
文件名全部
使用小写字母,单词与单词之间采用
**-**
连接,如
**user-info.vue,user-info-d
etail.vue**
,
3.
路由的注册
`import`
语句后的单词采用 Pascal命名法,所有单词的首字母大写,其余字母小写,单词与单词之间不使用任何符号风格。如
路由全部按需加载,按照如下写法,路由后面的单词为打包后的js名称,按照模块进行分割打包,注意不要全部一样,那样没有任何意义
```javascript
import HomeManager from '@/pages/HomeManager/HomeManager'
import LoadMore from '@/pages/LoadMore/LoadMore'
import UserInfo from '@/pages/UserInfo/UserInfo'
import UserInfoDetail from '@/pages/UserInfo/UserInfoDetail'
const HomeManager = resolve => require.ensure([], () => { resolve(require('@/pages/homeManager/home-manager')) }, 'home')
const LoadMore = resolve => require.ensure([], () => { resolve(require('@/pages/loadMore/load-more')) }, 'loadMore')
const UserInfo = resolve => require.ensure([], () => { resolve(require('@/pages/userInfo/user-info')) }, 'userInfo')
const UserInfoDetail = resolve => require.ensure([], () => { resolve(require('@/pages/userInfo/user-info-detail')) }, 'userInfo')
```
4.
实际路由注册需安照如下写法,
`path`
为
`/tab/文件名`
,
`/tab`
是否保留视实际情况而定。
`component`
后接的单词需和
`import`
的单词保持一致,
`name`
后接的单词也需和
`import`
的单词保持一致
```javascript
{path: "/tab/
HomeM
anager", component: HomeManager, name: 'HomeManager', meta: {keepAlive: true}},
{path: '/tab/
LoadM
ore', component: LoadMore, name: 'LoadMore', meta: {keepAlive: true}},
{path: '/tab/
UserI
nfo', component: UserInfo, name: 'UserInfo', meta: {keepAlive: true}},
{path: "/tab/
home-m
anager", component: HomeManager, name: 'HomeManager', meta: {keepAlive: true}},
{path: '/tab/
load-m
ore', component: LoadMore, name: 'LoadMore', meta: {keepAlive: true}},
{path: '/tab/
user-i
nfo', component: UserInfo, name: 'UserInfo', meta: {keepAlive: true}},
```
template/index.html
View file @
affc9754
...
...
@@ -9,7 +9,6 @@
<!-- safari私有meta标签 允许全屏模式浏览 指定safari顶部状态栏样式(黑色) -->
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
>
<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/prototype.js"
></script>
<script
type=
"text/javascript"
src=
"../../cordova.js"
></script>
<title>
车租易
</title>
...
...
template/src/common/utils/index.js
View file @
affc9754
...
...
@@ -19,7 +19,7 @@ export function timeout (time) {
* @param {any} msg 信息
*/
export
function
assert
(
condition
,
msg
)
{
if
(
!
condition
)
throw
new
Error
(
`[h
ips
]
${
msg
}
`
)
if
(
!
condition
)
throw
new
Error
(
`[h
ls-ui
]
${
msg
}
`
)
}
/**
...
...
@@ -50,3 +50,118 @@ export function detectOS () {
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]'
}
template/src/router/index.js
View file @
affc9754
import
Vue
from
'vue'
import
Router
from
'vue-router'
import
Home
from
'@/pages/home'
const
Home
=
resolve
=>
require
.
ensure
([],
()
=>
{
resolve
(
require
(
'@/pages/home'
))
},
'home'
)
Vue
.
use
(
Router
)
...
...
template/yarn.lock
View file @
affc9754
...
...
@@ -3841,18 +3841,6 @@ he@1.2.x, he@^1.1.0:
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
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:
version "1.0.1"
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment