PageSourceSearch

https://www.chinaventech.com/assets/js/unit/product-search.js

js chinaventech.com collected 2026-10-04 02:43:13 UTC 2,006 bytes, 74 lines download raw bytes

1/**
2 * 产品属性搜索组件
3 */
4class ScriptProductSearch extends Script {
5  constructor(params) {
6    super(params)
7    this.$unit = document.querySelector(`#${this.attrId}`)
8    if (!this.$unit) return
9    this.$allInput = this.$unit.querySelectorAll(`.unit-product-text-search__items .product-text-input`)
10    this.$searchBtn = this.$unit.querySelectorAll(`.unit-product-text-search__items .product-text-input-btnSearch`)
11	this.$close = this.$unit.querySelectorAll(`.unit-product-text-search__items .product-text-search-close`)
12  }
13
14  async init() {
15	this.initListeners()
16    if (this.utilts.checkDesign()) {
17      // 如果是装修时才调用
18    } else {
19      // 非装修模式使用html渲染
20    }
21  }
22
23  /**
24   *
25   */
26  initListeners() {
27    for (let $el of this.$searchBtn) {
28		$el.addEventListener('click', (e) => {
29			e.stopPropagation()
30			e.preventDefault()
31			this.searchData($el.parentNode.querySelector('.product-text-input').value)
32		})
33	}
34	for (let $el of this.$allInput) {
35		$el.addEventListener('input', (e) => {
36			e.stopPropagation()
37			e.preventDefault()
38			if(e.target.value!=''){
39				$el.parentNode.querySelector('.product-text-search-close').style.display = 'block';
40			}else{
41				$el.parentNode.querySelector('.product-text-search-close').style.display = 'none';
42			}
43		})
44		$el.addEventListener('keydown', (event) => {
45			event = event || window.event;
46			event.stopPropagation()
47			if (event.keyCode === 13) this.searchData($el.value)
48		})
49	}
50	for (let $el of this.$close) {
51		$el.addEventListener('click', (e) => {
52			e.stopPropagation()
53			e.preventDefault()
54			$el.style.display = 'none';
55			$el.parentNode.querySelector('.product-text-input').value = ''
56			this.searchData($el.parentNode.querySelector('.product-text-input').value)
57		})
58	}
59
60  }
61  initExpandMore() {
62   
63  }
64  initDropdownList() {
65   
66  }
67  /** 
68   * 获取产品属性参数
69   */
70  searchData(keyword) {
71		window.app.info.pagination.page_number = 1
72		window.app.info.renderListView(keyword)
73	}
74}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.