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
cb14e6c0
Commit
cb14e6c0
authored
Jul 23, 2021
by
nature2104
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webapp
parent
bbc0de27
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
0 additions
and
4888 deletions
+0
-4888
README.md
template/src/common/README.md
+0
-1
base.js
template/src/common/mixins/base.js
+0
-25
index.js
template/src/common/mixins/index.js
+0
-9
prefix.js
template/src/common/mixins/prefix.js
+0
-10
touch.js
template/src/common/mixins/touch.js
+0
-22
mui.css
template/src/common/mui/css/mui.css
+0
-4618
index.js
template/src/common/utils/index.js
+0
-167
ydui.flexible.js
template/src/common/ydui.flexible.js
+0
-36
No files found.
template/src/common/README.md
deleted
100644 → 0
View file @
bbc0de27
### 此文件夹存放第三方js
template/src/common/mixins/base.js
deleted
100644 → 0
View file @
bbc0de27
/**
* 基础 mixins
*/
import
{
case2Param
}
from
'../utils'
const
preName
=
'hls'
export
default
{
methods
:
{
/**
* 生成 css class helper
* c() // 'hls-componentName'
* c('wrap') // 'hls-componentName-wrap'
* c('wrap--active') // 'hls-componentName-wrap--active'
* @param {String} className 类名
* @returns String
*/
c
(
className
)
{
const
{
name
}
=
this
.
$options
// 组件名
return
className
?
`
${
preName
}
-
${
case2Param
(
name
)}
-
${
className
}
`
:
`
${
preName
}
-
${
case2Param
(
name
)}
`
},
},
}
template/src/common/mixins/index.js
deleted
100644 → 0
View file @
bbc0de27
import
base
from
'./base'
import
prefix
from
'./prefix'
import
touch
from
'./touch'
export
{
base
,
prefix
,
touch
,
}
template/src/common/mixins/prefix.js
deleted
100644 → 0
View file @
bbc0de27
const
preName
=
'hls'
export
default
{
methods
:
{
// 生成 css class
b
(
className
)
{
return
className
?
`
${
preName
}
-
${
className
}
`
:
''
},
},
}
template/src/common/mixins/touch.js
deleted
100644 → 0
View file @
bbc0de27
export
default
{
methods
:
{
onTouchStart
(
event
)
{
this
.
direction
=
''
this
.
deltaX
=
0
this
.
deltaY
=
0
this
.
offsetX
=
0
this
.
offsetY
=
0
this
.
startX
=
event
.
touches
[
0
].
clientX
this
.
startY
=
event
.
touches
[
0
].
clientY
},
onTouchMove
(
event
)
{
const
touch
=
event
.
touches
[
0
]
this
.
deltaX
=
touch
.
clientX
-
this
.
startX
this
.
deltaY
=
touch
.
clientY
-
this
.
startY
this
.
offsetX
=
Math
.
abs
(
this
.
deltaX
)
this
.
offsetY
=
Math
.
abs
(
this
.
deltaY
)
this
.
direction
=
this
.
offsetX
>
this
.
offsetY
?
'horizontal'
:
this
.
offsetX
<
this
.
offsetY
?
'vertical'
:
''
},
},
}
template/src/common/mui/css/mui.css
deleted
100644 → 0
View file @
bbc0de27
This diff is collapsed.
Click to expand it.
template/src/common/utils/index.js
deleted
100644 → 0
View file @
bbc0de27
/**
* 一些帮助函数
*/
/**
* setTimeout 的 promise 封装
* @param {Number} time
* @returns
*/
export
function
timeout
(
time
)
{
return
new
Promise
(
resolve
=>
{
setTimeout
(
resolve
,
time
)
})
}
/**
* 断言
* @param {any} condition 条件
* @param {any} msg 信息
*/
export
function
assert
(
condition
,
msg
)
{
if
(
!
condition
)
throw
new
Error
(
`[hls-ui]
${
msg
}
`
)
}
/**
* 改变 case 格式为 param
* @param {String} str 字符串
*/
export
function
case2Param
(
str
)
{
assert
(
typeof
str
===
'string'
,
'case2Param 传入数据类型错误:应为 String'
)
str
=
str
.
replace
(
/^
[
A-Z
]
/g
,
$0
=>
$0
.
toLowerCase
())
return
str
.
replace
(
/
[
A-Z
]
/g
,
$0
=>
`-
${
$0
.
toLowerCase
()}
`
)
}
/**
* 判断平台
* @return {String} 平台
*/
export
function
detectOS
()
{
const
ua
=
navigator
.
userAgent
.
toLowerCase
()
if
(
/MicroMessenger/i
.
test
(
ua
))
{
return
'weixin'
}
else
if
(
/iPhone|iPad|iPod|iOS/i
.
test
(
ua
))
{
return
'ios'
}
else
if
(
/Android/i
.
test
(
ua
))
{
return
'android'
}
else
{
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/common/ydui.flexible.js
deleted
100644 → 0
View file @
bbc0de27
/* eslint-disable */
/**
* YDUI 可伸缩布局方案
* rem计算方式:设计图尺寸px / 50 = 实际rem 例: 100px = 2rem
*/
!
(
function
(
window
)
{
/* 设计图文档宽度 */
var
docWidth
=
750
;
var
doc
=
window
.
document
,
docEl
=
doc
.
documentElement
,
resizeEvt
=
'orientationchange'
in
window
?
'orientationchange'
:
'resize'
;
var
recalc
=
(
function
refreshRem
()
{
var
clientWidth
=
docEl
.
getBoundingClientRect
().
width
;
/* 8.55:小于320px不再缩小,11.2:大于420px不再放大 */
docEl
.
style
.
fontSize
=
Math
.
max
(
Math
.
min
(
20
*
(
clientWidth
/
docWidth
),
11.2
),
8.55
)
*
5
+
'px'
;
return
refreshRem
;
})();
/* 添加倍屏标识,安卓倍屏为1 */
docEl
.
setAttribute
(
'data-dpr'
,
window
.
navigator
.
appVersion
.
match
(
/iphone/gi
)
?
window
.
devicePixelRatio
:
1
);
if
(
/iP
(
hone|od|ad
)
/
.
test
(
window
.
navigator
.
userAgent
))
{
/* 添加IOS标识 */
doc
.
documentElement
.
classList
.
add
(
'ios'
);
/* IOS8以上给html添加hairline样式,以便特殊处理 */
if
(
parseInt
(
window
.
navigator
.
appVersion
.
match
(
/OS
(\d
+
)
_
(\d
+
)
_
?(\d
+
)?
/
)[
1
],
10
)
>=
8
)
doc
.
documentElement
.
classList
.
add
(
'hairline'
);
}
if
(
!
doc
.
addEventListener
)
return
;
window
.
addEventListener
(
resizeEvt
,
recalc
,
false
);
doc
.
addEventListener
(
'DOMContentLoaded'
,
recalc
,
false
);
})(
window
);
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