searchbar.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div>
  3. <nut-demoheader
  4. :name="$route.name"
  5. ></nut-demoheader>
  6. <h5>示例用法</h5>
  7. <p>默认用法</p>
  8. <nut-searchbar
  9. placeText="请输入自定义文案"
  10. ></nut-searchbar>
  11. <p>右侧搜索按钮可根据需要进行配置</p>
  12. <nut-searchbar
  13. placeText="请输入自定义文案"
  14. :hasSearchButton="false"
  15. ></nut-searchbar>
  16. <p>可配置输入框前面是否显示搜索图标(图标可配置)、输入框高度、右侧是否显示文字按钮以及文字按钮宽度、显示文字、文字颜色</p>
  17. <nut-searchbar
  18. placeText="ERP/姓名/邮箱"
  19. :hasIcon="true"
  20. :hasTextButton="true"
  21. textInfo="搜索"
  22. width="1"
  23. height="1"
  24. color="#f23030"
  25. ></nut-searchbar>
  26. <p>可配置获取输入框焦点事件、输入事件、失去焦点事件、默认提交事件</p>
  27. <nut-searchbar
  28. placeText="请输入自定义文案"
  29. @focus="focusFun"
  30. @input="inputFun"
  31. @blur="blurFun"
  32. @submit="submitFun"
  33. ></nut-searchbar>
  34. </div>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. demo1: `<nut-searchbar placeText="请输入自定义文案"></nut-searchbar>`,
  41. demo2: `<nut-searchbar placeText="请输入自定义文案" :hasSearchButton="false"></nut-searchbar>`,
  42. demo3: `<nut-searchbar
  43. placeText="ERP/姓名/邮箱"
  44. :hasIcon="true"
  45. :hasTextButton="true"
  46. textInfo="搜索"
  47. width="1"
  48. height="1"
  49. color="#f23030"
  50. ></nut-searchbar>`,
  51. demo4: `<nut-searchbar
  52. placeText="请输入自定义文案"
  53. @focus="focusFun"
  54. @input="inputFun"
  55. @blur="blurFun"
  56. @submit="submitFun"
  57. ></nut-searchbar>`
  58. }
  59. },
  60. methods:{
  61. focusFun() {
  62. console.log('获取焦点操作!');
  63. },
  64. inputFun() {
  65. alert('您正在输入...');
  66. },
  67. blurFun() {
  68. console.log('您已失去焦点!');
  69. },
  70. submitFun() {
  71. console.log('默认提交操作!');
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. </style>