这是我尝试使用的插件:https://github.com/blinkmobile/cordova-plugin-sketch
Q)我试图让科多瓦的草图插件工作,这样我就可以注释一个图像,但不能让它正确初始化。我做错什么了?
页面加载良好,我没有收到任何错误警报,这是您可以看到的第二个回调函数。
是的,我在设备上运行。我知道cordova插件在浏览器里不起作用。
页面:
<ion-navbar *navbar header-colour>
<button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Sketch</ion-title>
</ion-navbar>
<ion-content padding>
<img #sketchElement src="img/sketchpad.jpg" height="400" width="600"/>
</ion-content>类:
import {NavController, NavParams} from 'ionic-framework/ionic';
import {Page, ViewController, Platform, Alert, Modal, Events} from 'ionic-framework/ionic';
import {forwardRef} from 'angular2/core';
import {OnInit, OnDestroy} from 'angular2/core';
import {ViewChild, ElementRef} from 'angular2/core';
@Page({
templateUrl: 'build/pages/sketch/sketch.html'
})
export class SketchPage {
@ViewChild('sketchElement') sketchElement:ElementRef;
constructor(
private _platform: Platform,
private _nav: NavController,
private _viewController: ViewController,
private _events: Events) {
}
ngOnInit() {
this._platform.ready().then(() => {
if(navigator && navigator.sketch) {
navigator.sketch.getSketch(
function() {
},
function(message) {
alert(message);
},
{
destinationType: navigator.sketch.DestinationType.DATA_URL,
encodingType: navigator.sketch.EncodingType.JPEG,
inputType : navigator.sketch.InputType.FILE_URI,
inputData : this.sketchElement.nativeElement.src
});
alert('done')
}
});
}
}谢谢!
发布于 2016-03-09 23:02:44
来自开发人员:
这只是一个窗口插件,我们将发布iOS/Android支持的近功能,但不是现在。
通过遵循本教程,我找到了另一种解决方案:
发布于 2016-03-09 16:07:24
您尝试过在config.xml文件中添加插件吗?
<gap:plugin name="cordova-plugin-sketch" source="npm" />https://stackoverflow.com/questions/35888497
复制相似问题