Blogger Information
Blog 6
fans 0
comment 0
visits 8847
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
uniapp获取并修改原生搜索框的占位内容
过夜茶
Original
1563 people have browsed it
  1. onLoad(e) {
  2. if(e.type){
  3. this.type=e.type;
  4. }
  5. let pageTitle='贴子';
  6. switch(this.type){
  7. case 'post':
  8. pageTitle='贴子'
  9. break;
  10. case 'topic':
  11. pageTitle='话题'
  12. break;
  13. case 'user':
  14. pageTitle='用户'
  15. break;
  16. }
  17. // #ifdef APP-PLUS
  18. // 修改搜索占位
  19. // 获取当前页面实例
  20. let currentWebView= this.$scope.$getAppWebview();
  21. // 加计时器延时,不加延时的话重复点击其他请求会报错
  22. setTimeout(function() {
  23. // 获取titleNview信息
  24. let tn=currentWebView.getStyle().titleNView;
  25. // 设置搜索框的占位内容并更新
  26. tn.searchInput.placeholder='搜索'+pageTitle;
  27. currentWebView.setStyle({
  28. titleNView:tn
  29. })
  30. }, 10);
  31. // #endif
  32. },
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post