我有一个组件,当用户点击组件它添加一些值存储,我尝试使用这种方式,但我得到一个错误:
OlapApp.MeasureListItemComponent = Ember.Component.extend({
tagName: 'li',
isDisabled: false,
attributeBindings: ['isDisabled:disabled'],
classBindings: ['isDisabled:MeasureListItemDisabled'],
actions: {
add: function(measure) {
var store = this.get('store');
store.push('OlapApp.AxisModel', {
uniqueName: measure.uniqueName,
name: measure.name,
hierarchyUniqueName: measure.hierarchyUniqueName,
type: 'row',
isMeasure: true,
orderId: 1
});
}
}
});
Run Code Online (Sandbox Code Playgroud)
这是错误的:
Uncaught TypeError: Cannot call method 'push' of undefined MeasureListItemComponent.js:18
Run Code Online (Sandbox Code Playgroud)
将记录从组件中存储起来是否可行?为什么我不能进入商店?我的模型名称是'AxisModel',应用程序命名空间是'OlapApp'
我需要十进制/浮点数的正则表达式,如12 12.2 1236.32 123.333和+12.00或-12.00或... 123.123 ...用于在javascript和jQuery中使用.谢谢.
我有这样一个数组:
var array = [1,20,50,60,78,90];
var id = 50;
Run Code Online (Sandbox Code Playgroud)
如何从数组中删除id并返回一个新数组中没有id值的新数组?
例如,我有一个像这样的控制器:
App.theController = Ember.ArrayController.extend({
methodA:funtcion() {},
actions: {
methodB:function(){},
methodC:function(){}
}
});
Run Code Online (Sandbox Code Playgroud)
我的问题是:
我需要一种方法来获取特定模型的第一个记录.这次我使用这样的方式:
this.store.findAll('configModel').then(function(items) {
items.get('content')[0].set('isEnableShowUniqueName', true);
items.get('content')[0].set('isSavedToServer', false);
items.get('content')[0].save();
});
Run Code Online (Sandbox Code Playgroud)
但我认为那里有更好的和更好的方式?这是真的吗?你知道更好的方法吗?但是知道我没有记录的ID我需要该模型的唯一第一条记录.
在我的应用程序中想要用来Intent
打开特定的电报频道或电报组.我在SF搜索,但我找不到任何东西.我尝试实现,但我只能打开用户可以选择但不是电报或特定电报组或频道的所有信使应用程序.如果在sf上找到这个,但它不能回答我的问题.
Intent myIntent = new Intent(Intent.ACTION_SEND);
myIntent.setType("text/plain");
myIntent.setPackage(appName);
myIntent.putExtra(Intent.EXTRA_TEXT, msg);//
mUIActivity.startActivity(Intent.createChooser(myIntent, "Share with"));
Run Code Online (Sandbox Code Playgroud) 在升级之前16.3
根据道具的变化对调用动作的版本作出反应我使用类似这样的代码:
componentWillReceiveProps(nextProps){
if(this.props.country.length !== nextProps.country){
doSomething(); //example calling redux action
}
}
Run Code Online (Sandbox Code Playgroud)
但在版本componentWillReceiveProps
的反应16.3
是不安全的,我们必须使用,getDerivedStateFromProps
但它说这个方法必须返回对象,我不知道我怎么可以模拟我以前componentWillReceiveProps
做的事情与做16.3
根据这个jsbin我有一个sortable
列表和一个按钮.当点击按钮的东西添加到sortable
,我想知道哪个事件sortable
被触发?(更新,接收),并在找到事件时对该事件做一些事情.
例如,如果用户点击add
按钮我想知道哪个事件被触发并在事件上做某事.例如,如果更新火我在可排序的更新方法中做了一些事情
$('.sort').sortable({
update:function(){
//if update fire do some thing
}
});
$('#add').click(function(){
$('.sort').append('<li>Text</li>');
});
Run Code Online (Sandbox Code Playgroud) 我有KOA如下:
var koa = require('koa'),
bodyParser = require('koa-body-parser'),
router = require('koa-router'),
app = koa();
app.use(router(app));
app.use(bodyParser());
app.post('http://localhost/get',getit);
function *getit(){
console.log(this.req.body); //undefined
}
Run Code Online (Sandbox Code Playgroud)
然后通过jquery ajax发送帖子请求:
var xhr = $.ajax({
type: 'POST',
dataType: 'json',
contentType: 'application/json',
url: 'http://localhost/getit',
data: {"name":"me"},
success: function(response) {
}
});
Run Code Online (Sandbox Code Playgroud)
但在koa和this.req
我无法找到我的数据.在谷歌浏览器开发者工具我可以看到标题和一切发送好,但我不能在koa看到它.
更新
正确的是:
function *getit(){
console.log(this.request.body); //undefined
}
Run Code Online (Sandbox Code Playgroud) Chrome中的Chrome开发人员工具可以模拟某些设备尺寸,甚至可以为视口设置自定义宽度(x)和高度(y).我的问题是我们可以使用自定义名称保存此自定义宽度或高度,或者只保存它.
ember.js ×3
javascript ×3
ember-data ×2
jquery ×2
ajax ×1
android ×1
decimal ×1
jquery-ui ×1
koa ×1
node.js ×1
react-native ×1
reactjs ×1
regex ×1
telegram ×1