uniapp绘制自定义顶部导航

startCreateView() {
				var me = this;
				me.titleTimer = setTimeout(function() {
					me.createView();
				}, 100); //具体缓迟时间可以按需设置  
			},
			createView() {
				clearTimeout(this.titleTimer);
				var webView = this.$mp.page.$getAppWebview();
				var nTitle = webView.getTitleNView();
				nTitle.draw(
					[{
							"tag": "rect",
							"id": "rect",
							"color": "#f1f2f3",
							"position": {
								"left": "12px",
								"right": "55px",
								"top": "7px",
								"bottom": "7px"
							},
							"rectStyles": {
								"color": "#f1f2f3",
								"radius": "5px",
								"borderColor": "#999"
							}
						},
						{
							"tag": "img",
							"id": "img",
							"src": "/static/index/icon_search.png",
							"position": {
								"left": "20px",
								"width": "14px",
								"height": "14px",
								"top": "15px",
							}
						},
						{
							"tag": "input",
							"id": "input",
							"position": {
								"left": "42px",
								"right": "70px",
								"top": "8px",
								"bottom": "7px"
							},
							"inputStyles": {
								"placeholder": "请输入企业名、人名、品牌、地址等",
								"borderRadius": "5px",
								"borderWidth": "0px",
								"fontSize": "14px",
								"type": "search",
								"color": "#999999",
								onComplete: function(e) {
									console.log('点击搜索执行')
								},
								onFocus: function(e) {
									console.log('获得焦点')
								},
								onBlur: function(e) {
									console.log('失去焦点')
								}
							}
						}
					]
				);
				nTitle.setInputFocusById("input", true);
			},

 

你可能感兴趣的:(uniapp)