当前位置:网站首页>layer.prompt(options, yes) - 输入层

layer.prompt(options, yes) - 输入层

2020-11-10 10:44:27 Ten years of heat and cold, never stop

prompt The parameters of are also complemented forward .options It can not only support passing in basic parameters , You can also pass in prompt Special properties . Of course , Or not .yes carry value Form value index Indexes elem Form Elements

  1. //prompt The new custom members of the layer are as follows
  2. {
  3. formType: 1, // Type of input box , Support 0( Text ) Default 1( password )2( Multiline text )
  4. value: '', // The initial value is , Default empty character
  5. maxlength: 140, // Maximum length of text that can be entered , Default 500
  6. }
  7. // Example 1
  8. layer.prompt(function(value, index, elem){
  9. alert(value); // obtain value
  10. layer.close(index);
  11. });
  12. // Example 2
  13. layer.prompt({
  14. formType: 2,
  15. value: ' Initial value ',
  16. title: ' Please enter the value ',
  17. area: ['800px', '350px'] // Custom text field width and height
  18. }, function(value, index, elem){
  19. alert(value); // obtain value
  20. layer.close(index);
  21. });

layer.prompt({
formType: 2,
value: ' Initial value ',
title: ' Please enter the value ',
area: ['800px', '350px'] // Custom text field width and height
}, function(value, index, elem){
console.log(elem[0].value); // obtain value
layer.close(index);
});

Learning style :

console.log(elem); 

console.log(elem[0]);

console.log(elem[0].value); 

console.log(elem[0].style)

console.log(elem[0].type); ;  

版权声明
本文为[Ten years of heat and cold, never stop]所创,转载请带上原文链接,感谢