polymer dart input binding int properties

前端 未结 3 1541
眼角桃花
眼角桃花 2021-01-07 12:02

What is the proper way of binding an input field to an int property on an object (e.g. input box changes and updates int property of an object causing another element who is

3条回答
  •  旧时难觅i
    2021-01-07 12:21

    You're on the right track here. The only problem is that the value attribute of the input element is a string. One way to do it is like this:

    
    
      
      
    
    

    //calc.dart
    import 'package:polymer/polymer.dart';
    
    @CustomTag('my-calc')
    class CalcElement extends PolymerElement {
      @observable String price = "0";
      @observable String qty = "0";
    
      CalcElement.created() : super.created();
    }
    

提交回复
热议问题