我正在VueJS 1.0中练习,而且我正在学习组件.在这里example
,有一个input
元素,必须从API 提供coupon
或某种类型的code
.我必须验证.我有我的<coupon >
组件,并有道具when-applied
.在when-applied
必须调用父功能setCoupon
,但它不会.
我只有这个错误this.whenApplied is not a function
.
<div id="demo" class="list-group">
<script id="coupon-template" type="x-template">
<input type="text" v-model="coupon" v-on:blur="whenCouponHasBeenEntered">
<div v-text="text"></div>
</script>
<coupon when-applied="setCoupon"></coupon>
</div>
Run Code Online (Sandbox Code Playgroud)
这是我的app.js
档案
Vue.component('coupon', {
template: '#coupon-template',
props: ['whenApplied'],
data: function() {
return {
coupon: '',
invalid: false,
text: ''
}
},
methods: {
whenCouponHasBeenEntered: function() {
this.validate();
},
validate: function() {
if( this.coupon == 'FOOBAR') { …
Run Code Online (Sandbox Code Playgroud) 安装期间显示以下错误:
Done loading packages.
Preparing to install archives
Downloading Android SDK Platform-tools, revision 26.0.2
Download interrupted: Connection to https://dl.google.com refused
Done. Nothing was installed.
Preparing to install archives
Downloading Android SDK Platform-tools, revision 26.0.2
Download finished with wrong checksum. Expected 98832431e339c82be1fe910a733a3782071200fd, got aa3ef6f18eff4b8f12dbdf980647a6ce6c2ebe8c.
Done. Nothing was installed.
Run Code Online (Sandbox Code Playgroud) 我想开始运行游戏2.5 ......但即使用激活器"play-java"安装模板也有错误.
Using unsupported version of Play: 2.5.0
Run Code Online (Sandbox Code Playgroud)
我已经下载了完整的激活器包和最小的.两台机器都失败了(JDK 73).
不知道如何赶上这个,也许有些人可以帮助我.我非常感激.
投注问候
我有一个运行我的服务的自定义AMI。使用AWS Java SDK,我使用RunInstancesRequest
AMI 创建EC2实例。现在,在开始使用服务之前,必须确保新创建的实例已启动并正在运行。我使用以下方法轮询实例:
var transitionCompleted = false
while (!transitionCompleted) {
val currentState = instance.getState.getName
if (currentState == desiredState) {
transitionCompleted = true
}
if(!transitionCompleted) {
try {
Thread.sleep(TRANSITION_INTERVAL)
} catch {
case e: InterruptedException => e.printStackTrace()
}
}
}
Run Code Online (Sandbox Code Playgroud)
因此,当currentState
实例的变成desiredState
(是running
)时,我得到实例已准备就绪的状态。但是,任何新创建的实例尽管处于running
状态,但仍在初始化中,因此无法立即使用。
如何确保仅在能够访问实例及其服务时才返回?是否要进行任何特定的状态检查?
PS:我使用Scala
我有一个JSON字符串,内容如下:
[{
"id": "id2",
"index": "2",
"str": "str2",
"cent": "200",
"triplet": "222"
},
{
"id": "id3",
"index": "3",
"str": "str3",
"cent": "300",
"triplet": "333"
},
{
"id": "id4",
"index": "4",
"str": "str4",
"cent": "400",
"triplet": "444"
},
{
"id": "id5",
"index": "5",
"str": "str5",
"cent": "500",
"triplet": "555"
}]
Run Code Online (Sandbox Code Playgroud)
键值对来自服务器,我不会事先知道预期的数据.对于我使用的图表库,我需要JSON中的值是数字而不是字符串viz."index":2
而不是"index":"2"
我需要使用纯JS或jQuery进行客户端操作.
这是我的方法,但它似乎不起作用:
var temp = //some json that I receive
var jsonForChart = jQuery.extend(true, {}, temp);
$.each(temp, function(key, value) {
$.each(value, function(k, v) {
if(!isNaN(v)){
jsonForChart[key][k] = …
Run Code Online (Sandbox Code Playgroud) javascript ×2
scala ×2
amazon-ec2 ×1
android ×1
appium ×1
aws-java-sdk ×1
aws-sdk ×1
jquery ×1
sdk ×1
vue.js ×1