手册版本 V3.0
组件名称
graceScroll : /graceUI/组件目录/graceScroll
graceScroll 组件原理
1、普通版本
利用 css 动画循环滚动公告元素;
.grace-scrolling{animation:graceScrollingx 12s linear infinite;}
@keyframes graceScrollingx{ 0% { transform: translateX(100%); } 100% { transform: translateX(-200%); }}
2、nvue 版本利用 marginleft 动画实现实际项目请参考此组件改进即可;
普通版本组件插槽
请在插槽内放置需要滚动的元素即可;
nvue 版本组件属性
msg : { type : String, default : "" } // 消息内容
fontSize : { type : String, default : "26rpx"} // 文本大小
color : { type : String, default : "#333333" } // 文本颜色
fontWeight : { type : String, default : "" }// 文本是否加粗演示代码
UNI 普通版本
NVUE 版本
微信小程序独立版本
<template>
<gracePage :customHeader="false">
<view slot="gBody">
<view class="scrolldemo">
<text class="scroll-icon grace-icons icon-speaker grace-blue"></text>
<view style="width:650rpx;">
<graceScroll>
<text>GraceUI 兼容微信小程序、uni-app,一套代码多端发布!完美兼容多个平台!</text>
</graceScroll>
</view>
</view>
</view>
</gracePage>
</template>
<script>
import gracePage from "../../graceUI/components/gracePage.vue";
import graceScroll from '../../graceUI/components/graceScroll.vue';
export default{
data() {
return {
}
},
components:{
gracePage, graceScroll
},
methods:{}
}
</script>
<style>
.scrolldemo{display:flex; flex-wrap:nowrap; justify-content:space-between; align-items:center; padding:15rpx; background:#F5F6F8;}
.scroll-icon{width:60rpx; text-align:center; font-size:32rpx; height:60rpx; line-height:60rpx; flex-shrink:0;}
</style>
<template>
<gracePage :customHeader="false">
<view slot="gBody">
<view class="scrolldemo grace-nowrap grace-flex-vcenter">
<text class="scroll-icon grace-icons grace-blue"></text>
<view style="width:650rpx; flex:1;">
<graceScroll msg="GraceUI 兼容微信小程序、uni-app,一套代码多端发布!完美兼容多个平台!"></graceScroll>
</view>
</view>
</view>
</gracePage>
</template>
<script>
import gracePage from "../../graceUI/weexComponents/gracePage.nvue";
import graceScroll from '../../graceUI/weexComponents/graceScroll.nvue';
export default{
data() {
return {
}
},
components:{
gracePage, graceScroll
},
methods:{}
}
</script>
<style>
.scrolldemo{padding:15rpx; background-color:#F5F6F8;}
.scroll-icon{width:60rpx; text-align:center; font-size:32rpx;}
</style>
wxml
<gracePage customHeader="{{false}}">
<view slot="gBody">
<view class="scrolldemo">
<text class="scroll-icon grace-icons icon-speaker grace-blue"></text>
<view style="width:650rpx;">
<graceScroll>
<text>GraceUI 兼容微信小程序、uni-app,一套代码多端发布!完美兼容多个平台!</text>
</graceScroll>
</view>
</view>
</view>
</gracePage>.wxss
.scrolldemo{display:flex; flex-wrap:nowrap; justify-content:space-between; align-items:center; padding:15rpx; background:#F5F6F8;}
.scroll-icon{width:60rpx; text-align:center; font-size:32rpx; height:60rpx; line-height:60rpx; flex-shrink:0;}.json
{
"usingComponents": {
"gracePage": "../../graceUI/components/gracePage",
"graceScroll": "../../graceUI/components/graceScroll"
}
}