About liangyongfei

该作者尚未填入任何详情
So far liangyongfei has created 485 blog entries.

APP 点击 attachmentSimple 组件上传文件时设置要显示的选项

3.4版本中,model\Native\templates\advanced\platforms\android\JustepGetContent\src\main\res\layout\file_upload_chooser.xml 自己进去改吧,把不要的button隐藏掉。不要直接删除,会异常 比如不需要录音(主要配置:android:visibility="gone") </blockquote> <blockquote><Button android:id="@+id/btn_record_audio" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white" android:text="录音" android:textColor="@color/blue_text" android:visibility="gone" /></blockquote> <blockquote> 3.5版本设置attachmentSimple组件的accept 属性,选择枚举出的选项就可以了!

屏幕横向显示和纵向显示

3.4版本的案例路径是\UI2\demo\native\screenorientation\demo.w 3.5版本的案例路径是:/UI2/demo/plugin/screenOrientation/demo.w //竖屏模式 Model.prototype.portraitClick = function(event){ cordova.plugins.screenorientation.setOrientation('portrait'); }; //横屏模式 Model.prototype.landscapeClick = function(event){ cordova.plugins.screenorientation.setOrientation('landscape'); }; //屏幕方向解锁 Model.prototype.unlockClick = function(event){ cordova.plugins.screenorientation.setOrientation('unlocked'); }; //获取当前屏幕方向 Model.prototype.currentClick = function(event){ setTimeout(function(){ alert("当前屏幕方向: " + JSON.stringify(window.screen.orientation)); }); }; [...]

list组件点击事件中获取当前行

list组件中点击事件中获取当前行对象的方法是:event.bindingContext.$object 获取这行数据的某个列的值可以是event.bindingContext.$object.val('fName'); 修改当前行某个列的值,可以是event.bindingContext.$object.val('fName','张三');   注意:list组件中class属性为  x-list-template 的标签 下面的子标签 才是 list循环显示的部分,点击事件必须在class= x-list-template 的子节点中设置!否则无法点击事件得到当前行对象  

执行saveData方法 mysql 中是乱码

原因:自己配置的mysql数据库,查看正常,当执行baasData.saveData() 保存数据时,出现问题!数据库中存储的是乱码!,这个是因为数据库编码问题!我们WeX5平台使用的编码一律是UTF-8 解决方案: 在 mysql 的配置文件my.cnf(Linux 下在/etc 目录)中加入 character_set_server=utf8 lower_case_table_names=1

3.4版本 attachmentSimple组件 在某些手机APP上报错找不到文件 /…/1.chunk.js

原因:3.4版本 APP打包后,在某些手机上运行报错, 找不到/UI2/system/components/justep/uploader/plugins/compress/dist/1.chunk.js 解决方法: 在这个文件中添加一行代码:/UI2/system/components/justep/uploader/uploader-html5.js require("res!./plugins"); 然后执行\tools\dist\dist.bat 合并资源! 重新打包就可以了! 3.5版本已经解决这个问题

list组件动态设置filter

1.list组件在filter属性中,判断条件绑定ko对象, var Model = function(){ this.callParent(); this.type=justep.Bind.observable('全部');//建立可观察对象,用于数据感知,分三个状态(全部,迟到,早退); }; list的filter属性使用表达式:'全部'===$model.type.get()|| $row.val(状态列)===$model.type.get() 迟到按钮的代码:this.type.set('迟到'); 早退按钮的代码:this.type.set('早退'); 这样就可以了; 2.需求,比如点一个按钮,根据年龄过滤,点击另一个按钮,根据名字过滤,等条件。显示list中的数据!list组件filter绑定一个js方法设置动态过滤条件,比如:$model.testFilterType($row) 初始化定义ko对象:this.type= justep.Bind.observable('1'); 这个时候,js改成这样 Model.prototype.testFilterType = function(row){ if(this.type.get() == '1'){ return row.val('fAge')>20; } esle if(this.type.get() == '2'){ return row.val('fName') =='张三'; } 。。。。 [...]