起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1469|回复: 4

[处理中3] 使用JavaScript表达式 不能正常显示

[复制链接]

84

主题

382

帖子

633

积分

高级会员

Rank: 4

积分
633
发表于 2016-12-26 09:29:46 | 显示全部楼层 |阅读模式
w.
<p>你的手机号:
                 <input type = 'text' bind-value = "cellphoneNumber" bind-enable = "hasCellphone"></input>        
         <!--使用JavaScript表达式    不能正常显示
         <button bind-enable = "cellphoneNumber.get().length == 11">
                    拨打
         </button>
         -->
         </p>
js.
this.hasCellphone = justep.Bind.observable(false);
this.cellphoneNumber = "";

错误显示:cellphoneNumber.get() is not a function
想问下遇到这样的问题该怎么解决
发表于 2016-12-26 11:45:17 | 显示全部楼层
his.cellphoneNumber =  justep.Bind.observable('');
请这样定义变量,表示KO对象
KO对象才有get  set 方法!
一个普通字符串变量肯定没有这个方法的!
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

84

主题

382

帖子

633

积分

高级会员

Rank: 4

积分
633
 楼主| 发表于 2016-12-26 15:01:44 | 显示全部楼层
liangyongfei 发表于 2016-12-26 11:45
his.cellphoneNumber =  justep.Bind.observable('');
请这样定义变量,表示KO对象
KO对象才有get  set  ...

谢谢
回复 支持 反对

使用道具 举报

84

主题

382

帖子

633

积分

高级会员

Rank: 4

积分
633
 楼主| 发表于 2016-12-26 15:04:30 | 显示全部楼层
<!-- 支持让用户选择任意JavaScript对象 -->
        <select bind-options = "availableCountries" bind-optionsText = "function(item){return item.countryName + '(人口: + 'item.countryPopulation +')'}"
        bind-selectedOptions = "selectedCountry" size = "5" multiple = "true"></select>
        <button bind-click = "buttonClick">显示选中信息</button>

js:
var Country = function(name,population){
      this.countryName = name;
      this.countryPopulation = population;
};
var Model = function(){
      this.callParent();
};
请问下这个问题出在哪里,一直实现不出来
回复 支持 反对

使用道具 举报

发表于 2016-12-26 15:53:14 | 显示全部楼层
xcl 发表于 2016-12-26 15:04
显示选中信息

js:

select 绑定自定义方法的做法参考:
http://doc.wex5.com/comps-select/#008

第四个案例
.字典表下拉指定数据集合

另外这里也有案例:/UI2/system/components/justep/select/demo/listselect.w
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2025-6-26 02:10 , Processed in 0.058019 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表