text-input.js 912 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // components/my-form/my-input.js
  2. Component({
  3. /**
  4. * 组件的初始数据
  5. */
  6. options:{
  7. addGlobalClass: true,
  8. },
  9. properties:{
  10. label:{
  11. type:String,
  12. value:'',
  13. },
  14. formid:{
  15. type: String,
  16. value: '',
  17. },
  18. forminfo:{
  19. type:Object,
  20. value:{}
  21. },
  22. role:{
  23. type:Object,
  24. value:{}
  25. }
  26. },
  27. data: {
  28. input_text:'',
  29. },
  30. behaviors: ['wx://component-export'],
  31. //组件最终对外导出的数据
  32. export() {
  33. return {
  34. input_text: this.data.input_text,
  35. force: this.properties.forminfo.force,
  36. role: this.properties.forminfo.role
  37. }
  38. },
  39. /**
  40. * 组件的方法列表
  41. */
  42. ready:function(){
  43. console.log(this.properties);
  44. },
  45. methods: {
  46. enterValue:function(e){
  47. console.log(e.detail.value);
  48. this.setData({
  49. input_text: e.detail.value
  50. });
  51. }
  52. }
  53. })