Mobile.php 607 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Dcat\Admin\Form\Field;
  3. use Dcat\Admin\Admin;
  4. class Mobile extends Text
  5. {
  6. /**
  7. * @see https://github.com/RobinHerbots/Inputmask#options
  8. *
  9. * @var array
  10. */
  11. protected $options = [
  12. 'mask' => '99999999999',
  13. ];
  14. public function render()
  15. {
  16. $this->inputmask($this->options);
  17. $this->prepend('<i class="ti-mobile"></i>')
  18. ->defaultAttribute('style', 'width: 200px');
  19. return parent::render();
  20. }
  21. public static function collectAssets()
  22. {
  23. Admin::collectComponentAssets('jquery.inputmask');
  24. }
  25. }