我正在尝试将vis.js
添加到已有4年历史的Web应用程序中。
当我运行应用程序而不打包所有内容时,它可以运行。但是,当我用public class AddDialog extends Dialog implements android.view.View.OnClickListener{
Activity a;
Dialog d;
Button add , cancel;
RadioButton owes,lent ,money,things ;
EditText name ,amount,object,note;
Spinner spin;
public AddDialog(Activity c) {
super(c);
this.a = c;
}
@Override
public void onClick(View v){
};
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.dialogedit);
add=(Button)findViewById(R.id.buttonAdd);
cancel=(Button)findViewById(R.id.buttonCancel);
owes = (RadioButton)findViewById(R.id.radioButtonOwes);
lent = (RadioButton)findViewById(R.id.radioButtonLent);
money = (RadioButton)findViewById(R.id.radioButtonAmount);
things =(RadioButton)findViewById(R.id.radioButtonThings);
name = (EditText)findViewById(R.id.editName);
object = (EditText)findViewById(R.id.editTextWhat);
amount =(EditText)findViewById(R.id.editTextAmount);
note =(EditText)findViewById(R.id.editTextNote);
spin=(Spinner) findViewById(R.id.spinnerdevise);
owes.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
lent.setChecked(false);
}
});
lent.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
owes.setChecked(false);
}
});
money.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
things.setChecked(false);
object.setEnabled(false);
amount.setEnabled(true);
spin.setEnabled(true);
object.setText("");
}
});
things.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
money.setChecked(false);
object.setEnabled(true);
amount.setEnabled(false);
spin.setEnabled(false);
amount.setText("");
}
});
object.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
things.performClick();
things.setChecked(true);
}
});
amount.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
money.performClick();
money.setChecked(true);
}
});
打包所有内容时,我在浏览器的控制台中收到以下错误:
匿名的define()模块
不匹配
当我注释掉代码时
<html>
<head>
<meta name="description" content="Drawing Shapes w/ D3 - " />
<meta charset="utf-8">
<title>Drawing SVG Shapes with D3</title>
<script src="d3.v3.js" charset="utf-8"></script>
<style>
circle {
stroke-width: 5;
stroke:steelblue;
fill:#888;
fill-opacity: .5;
}
rect {
stroke-width: 1;
stroke:steelblue;
fill:#888;
fill-opacity: .5;
}
line {
stroke: red;
stroke-linecap: round;
stroke-width: 5;
}
</style>
</head>
<body>
<script>
function makeData(n){
var arr = [];
for (var i=0; i<n; i++){
arr.push({
x:Math.floor((Math.random() * 100) + 1),
y:Math.floor((Math.random() * 100) + 1),
width:Math.floor((Math.random() * 100) + 1),
height:Math.floor((Math.random() * 100) + 1)
})
};
return arr;
}
var data = makeData[2];
var svg = d3.select("body")
.append("svg")
.attr("width",200)
.attr("height",200);
svg.selectAll("rect")
.data(data)
.enter()
.append("rect")
.attr("x", function(d) { return d.x; })
.attr("y", function(d) { return d.y; })
.attr("width", function(d) { return d.width; })
.attr("height", function(d) { return d.height; });
</script>
</body>
</html>
错误消失了,但显然我再没有任何访问权限了。
我似乎正在执行the example中显示的所有内容,但在加载require.js时使用grunt
除外。那是因为use-min不再支持它。
答案 0 :(得分:1)
我和其他库(NanoModal)有同样的问题。对我有用的唯一解决方案是使用paths
优化器的r.js
配置从打包中排除该库:
paths: {
"nanomodal": "empty:"
}