如何在vue .js上创建具有相同值的复选框

时间:2019-01-18 15:01:47

标签: javascript vue.js checkbox

我如何使其中一个复选框为true不会全部变为true,这就是复选框具有相同值的方式,如果我是对的,则所有这些复选框都不遵循true 其myCode

@implementation LoadingView

- (instancetype)init {
    self = [super init];
    if(self) {
        self.frame = CGRectMake(100, 100, 200, 200);
    }
    return self;
}

- (void)didMoveToSuperview {
    self.backgroundColor   = [UIColor greenColor];
    CAShapeLayer* pieShape = [CAShapeLayer layer];
    CGFloat radius         = 50;

    pieShape.path =
        [UIBezierPath bezierPathWithRoundedRect:CGRectMake(self.frame.size.width / 2 - radius, self.frame.size.height / 2 - radius, 100, 100) cornerRadius:radius].CGPath;
    pieShape.fillColor   = nil;
    pieShape.strokeColor = [UIColor blackColor].CGColor;
    pieShape.strokeStart = 0.f;

    pieShape.lineWidth = radius * 2.f;

    UIImageView* starView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"star"]];
    starView.frame        = CGRectMake(self.frame.size.width / 2 - 50.f, self.frame.size.height / 2 - 50.f, 100, 100);
    starView.contentMode  = UIViewContentModeScaleAspectFit;

    starView.layer.mask = pieShape;

    [self addSubview:starView];

    CABasicAnimation* pathAnimation   = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
    pathAnimation.duration            = 5.0;
    pathAnimation.fromValue           = @(0.f);
    pathAnimation.toValue             = @(1.f);
    pathAnimation.removedOnCompletion = NO;
    pathAnimation.fillMode            = kCAFillModeForwards;
    [pieShape addAnimation:pathAnimation forKey:@"strokeEndAnimation"];
}

@end

 <section id="app">
<table>
<tr>
    <td> <input type="checkbox" true-value="1" false-value="0" v-model="ai"></td>
    <td> <input type="checkbox" true-value="1" false-value="0" v-model="ai"></td>
    <td> <input type="checkbox" true-value="1" false-value="0" v-model="ai"></td>
    <td> <input type="checkbox" true-value="1" false-value="0" v-model="ai"></td>
    <td> <input type="checkbox" true-value="1" false-value="0" v-model="ai"></td>
    <td>{{ai}}</td>
</tr>

1 个答案:

答案 0 :(得分:0)

您需要将ai: ''更改为ai: []

来自

data: {
  ai: ''
}

data: {
  ai: []
}

您可以在documentation中看到示例,