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

QQ登录

只需一步,快速开始

查看: 1581|回复: 1

[暂结贴(7天未回复)] [WeX5_V3.4]toast无法使用

[复制链接]

8

主题

19

帖子

67

积分

初级会员

Rank: 2

积分
67
QQ
发表于 2016-4-9 00:38:44 | 显示全部楼层 |阅读模式
路径为/UI2/demo/native/toast/index.w的例子中,当运行时会提示Cannot read property 'toast' of undefined的错误提示框,错误语句指向window.plugins.toast.show这段代码。

  1. define(function(require) {
  2.         var $ = require("jquery");
  3.         var justep = require("$UI/system/lib/justep");
  4.         require("$UI/system/lib/cordova/cordova");
  5.         require("cordova!cordova-plugin-x-toast");

  6.         var Model = function() {
  7.                 this.callParent();
  8.                 this.onSuccess = function(msg) {
  9.                         justep.Util.hint("Toast shown: "+msg);
  10.                 }
  11.                 this.onError = function(msg) {
  12.                         justep.Util.hint("Toast error: "+msg);
  13.                 }
  14.         };

  15.         Model.prototype.showToastClick = function(event) {
  16.                 window.plugins.toast.show("this is a test letter", "long", "center",this.onSuccess,this.onError);
  17.         };

  18.         Model.prototype.hiddenToastClick = function(event) {
  19.                 window.plugins.toast.hide(this.onSuccess,this.onError);
  20.         };

  21.         Model.prototype.tweakvpositionClick = function(event){
  22.                 window.plugins.toast.showWithOptions({
  23.                         message : "hey here",
  24.                         duration : "short",//持续时间
  25.                         position : "bottom",//显示位置
  26.                         addPixelsY : -40//缺省为0
  27.                 },this.onSuccess,this.onError);
  28.         };

  29.         return Model;
  30. });
复制代码


请问大侠问题出在哪里?谢谢!
发表于 2016-4-11 13:27:10 | 显示全部楼层
cordova插件只能打包在app中,安装后才可以使用!!
如果在其他环境,比如浏览器是无法运行cordova插件的!
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-3 15:34 , Processed in 0.062571 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

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