wanghaoui
v1.1.10
Published
``` **yarn add wanghaoUI
Downloads
15
Maintainers
Readme
yarn add wanghaoUI
main.js:
import wanghaoUI from 'wanghaoUI'
Vue.use(wanghaoUI)
组件:
列表滚动 whScrollList:
浏览器全屏功能 whScreenfull:
饼图组件 whPie:
列表滚动 whScrollList:
<!-- 0 往下 1 往上 -->
<wh-scroll-list
:data="listData"
:class-option="classOption"
:max="50"
class="warp"
>
<ul class="upDownUl">
<li class="upDownLi" v-for="(item, index) in listData" :key="index">
<span class="title" v-text="item.name"></span>
</li>
</ul>
</wh-scroll-list>
<!-- 2向左 3向右 -->
<!-- <wh-scroll-list
:data="listData"
:class-option="classOption"
:max="50"
class="leftRightWarp"
:style="{width: 130 * 4 + 'px'}"
>
<ul class="leftRightUl">
<li class="leftRightLi" v-for="(item, index) in listData" :key="index">
{{ index }}
</li>
</ul>
</wh-scroll-list> -->
export default {
name: 'ScrollList',
data() {
return {
listData: [{
'name': '无缝滚动1',
}, {
'name': '无缝滚动2',
}, {
'name': '无缝滚动3',
}, {
'name': '无缝滚动4',
}, {
'name': '无缝滚动5',
}, {
'name': '无缝滚动6',
}, {
'name': '无缝滚动7',
}, {
'name': '无缝滚动8',
}, {
'name': '无缝滚动9',
}],
classOption: {
limitMoveNum: 5, //启动无缝滚动最小数据数
hoverStop: true, //是否启用鼠标hover控制
direction: 1, // 0 往下 1 往上 2向左 3向右
openTouch: true, //开启移动端touch
autoPlay: true,
isSingleRemUnit: false // singleWidth/singleHeight 是否开启rem度量
}
}
},
mounted() {
},
methods: {
}
}
</script>
<style scoped>
.warp {
height: 270px;
width: 360px;
margin: 0 auto;
overflow: hidden;
}
.upDownUl {
list-style: none;
padding: 0;
margin: 0 auto;
}
.upDownLi{
display: block;
height: 30px;
line-height: 30px;
display: flex;
justify-content: space-between;
font-size: 15px;
}
.leftRightWarp{
width: 520px;
height: 120px;
margin: 0 auto;
overflow: hidden;
}
.leftRightUl{
display: flex;
list-style: none;
padding: 0;
margin: 0 auto;
}
.leftRightLi{
width: 120px;
height: 120px;
margin-right: 10px;
line-height: 120px;
background-color: #999;
color: #fff;
text-align: center;
font-size: 30px;
}
</style>
浏览器全屏功能 whScreenfull:
<wh-screenfull ref="screenfull" @getFullScreenStatus="getFullScreenStatus">
<div class="btn" @click="clickFullscreen()">{{ isFullscreen ? '退出全屏' : '全屏' }}</div>
</wh-screenfull>
export default {
name: 'screenfull',
data() {
return {
isFullscreen: false,
}
},
mounted() {
},
methods: {
getFullScreenStatus(status) {
this.isFullscreen = status
},
clickFullscreen() {
this.$refs.screenfull.toggleFullscreen()
},
}
}
</script>
<style scoped>
.btn{
color: white;
cursor: pointer;
}
</style>
饼图组件 whPie:
<wh-pie :chartData.sync="chartData" width="443px" height="278px"></wh-pie>
mounted () {
setTimeout(() => {
this.chartData = [{
name: '测试1',
value: 1
}, {
name: '测试2',
value: 2
}, ]
}, 2000)
},