【发布时间】:2016-12-15 17:59:22
【问题描述】:
我想在 Ionic 应用程序中使用 Raphael 库绘制一个矩形。 HTML 代码是:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link rel="manifest" href="manifest.json">
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="cordova.js"></script>
<script src="js/app.js"></script>
<script src="js/raphael.min.js"></script>
<script src="js/main.js"></script>
</head>
<body ng-app="starter" >
<!--ion-pane>
<ion-header-bar class="bar-energized">
<h1 class="title">Ionic Blank Starter</h1>
</ion-header-bar>
</ion-pane-->
<div id="myCanvas"></div>
</body>
</html>
APP.JS 代码是经典的 Ionic 代码,由框架创建:
angular.module('starter', ['ionic'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
MAIN.JS 代码是:
function initDrawing() {
var paper = Raphael("myCanvas", 500,500);
var rect1 = paper.rect(20,30,100,30).attr({fill: "orange"});
}
window.onload = initDrawing;
运行代码没有出现矩形。请帮我解决问题。
【问题讨论】:
-
你为什么不在 Ionic 中为此创建卡片?
-
@Anuj Gupta - 不适用于卡
标签: javascript ionic-framework raphael