您当前的位置: 首页 > 

xiangzhihong8

暂无认证

  • 0浏览

    0关注

    1324博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Weex开发之mask

xiangzhihong8 发布时间:2019-02-01 11:19:04 ,浏览量:0

mask弹层示例

在移动开发中,我们经常会做一些弹框相关的东西,在Weex跨平台框架中,实现mask效果也比较简单。下面是示例效果: 在这里插入图片描述在这里插入图片描述

以下是示例代码:


    
广告
评论
差 一般 很好
取消
确认
import {WxcMask} from 'weex-ui'; let domModule = weex.requireModule('dom') export default { components: {'wxc-mask': WxcMask}, data: () => ({ show: false, showMask: false, score:5, hasAnimation: true }), methods: { created() { this.initIconFont(); }, initIconFont() { domModule.addRule('fontFace', { 'fontFamily': 'iconfont', 'src': "url('http://at.alicdn.com/t/font_1028673_vs1slhfmpy.ttf')" }) }, setScore(v){ if(v===this.score){ this.score = v-1; }else{ this.score = v; } }, wxcMaskSetHidden() { this.show = false; }, showAd(){ this.show = true; }, showStar(){ this.showMask = true; }, cancel(){ this.showMask = false; }, confirm(){ this.showMask = false; }, } }; .iconfont { font-family: iconfont; } .wrapper { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: #e0000000; } .comment-btn { background-color: #419DFB; width: 176px; height: 60px; margin-top: 40px; align-self: center; justify-content: center; border-radius: 8px; } .comment-text { font-size: 28px; color: #ffffff; text-align: center; } .mask { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, .4); align-items: center; justify-content: center; flex: 1; } .mask-image { height: 700px; width: 560px; align-items: center; border-radius: 30px; } .mask-dialog { width: 540px; border-radius: 28px; background-color: #eeeeee; align-items: center; padding-top: 30px; } .star-on { color: #ffd900; } .star-off { color: #cfd9e6; } .grade-box { width: 230px; flex-direction: row; justify-content: space-between; margin-bottom: 30px; } .grade-txt { font-size: 28px; color: #5c7799; } .star-group{ flex-direction: row; height: 30px; width: 480px; margin-bottom:10px; justify-content: center; } .textarea { width: 480px; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; color: #5c7799; placeholder-color: #a4b6cc; font-size: 28px; background-color: #fff; } .mask-btngroup { width: 540px; height: 88px; flex-direction: row; border-top-width: 1px; border-top-color: #cfd9e6; margin-top: 30px; } .mask-btngroup-item { height: 88px; flex: 1; justify-content: center; align-items: center; border-radius: 100px; } .mask-item-txt{ font-size: 32px; color: #419dfb; } .line { height: 88px; width: 1px; background-color: #cfd9e6; } .mr5 { margin-right: 10px; } .bold { font-weight: bold; }
eros-yanxuan 简介

eros-yanxuan 是基于 eros 开发的Weex项目,部分页面参考了项目网易严选 weex 版本,欢迎star或fork。

  • eros 文档
  • eros github
运行

确保你本地已经集成了 eros 开发所需的环境。

clone 项目到本地:

$ git clone https://github.com/xiangzhihong/eros-yanxuan.git

进入目录,下载前端所需的依赖:

$ cd eros-yanxuan
$ npm install
iOS SDK

打开platforms目录下的WeexEros项目,在WeexEros中使用pod添加依赖。

$ cd platforms/ios/WeexEros
$ pod update                // 下载 iOS 依赖
$ open WeexEros.xcworkspace // 自动打开项目

选中模拟器,点击绿色箭头运行 app 即可。

Android

对于Android工程来说,使用Android Studio打开platforms目录下的WeexFrameworkWrapper的Android工程,然后使用install.sh安装Android工程的需要依赖包nexus和wxframework。

具体可以参考自行导入项目,便可运行起来。

运行
  • 项目根目录下运行 eros dev
  • 关闭调试,拦截器,打开热更新
  • 重新 build app
效果

在这里插入图片描述

Question

运行过程中出现问题在以下地址解决方法,如果没有找到,可以参考eros快速入门新建一个Weex工程,然后将src和配置文件的代码拷贝过去。 如果还有问题,请加群:515980159

  • 移动跨平台技术总结
  • Weex快速上手
  • eros快速入门
  • eros issue
  • eros Q&A
关注
打赏
1482932726
查看更多评论
立即登录/注册

微信扫码登录

0.0424s