1class ScriptMatchingProduct extends Script { 2 constructor(params) { 3 super(params) 4 this.attrList = JSON.parse(params.attrList) 5 this.attrId = params.attrId 6 } 7 /** åå§åï¼æ¯æå¼æ¥ */ 8 init() { 9 if (this.attrList.length === 0) return 10 this.initVue() 11 } 12 async initVue() { 13 const _this = this 14 await new Load('/assets/plugins/vue.min.js') 15 new Vue({ 16 el: `#${this.attrId} .unit-matching-product`, 17 data: { 18 search_active_content: '', 19 is_default: true, 20 result: { 21 status: false, 22 content: '' 23 }, 24 modal: null, 25 // ç¼åmodalï¼é²æ¢éå¤è¯·æ±æ°æ® 26 modalPromise: null 27 }, 28 created() { 29 this.initModal() 30 }, 31 methods: { 32 /** åå§åmodalï¼éå¤è°ç¨è¿ååä¸ä¸ªpromiseï¼é²æ¢éå¤è¯·æ±æ°æ® */ 33 async initModal() { 34 if (!this.modalPromise) { 35 // ç¼åmodalï¼é²æ¢éå¤è¯·æ±æ°æ® 36 this.modalPromise = new Promise(async resolve => { 37 await new Load('/assets/plugins/quick-search.js') 38 this.modal = await new PluginQuickSearch({ attrId: this.attrId, type: 2 }).modal({ 39 onSubmit: () => { 40 this.changeSearch(this.modal.searchId) 41 this.modal.closeModal() 42 } 43 }) 44 resolve() 45 }) 46 } 47 return this.modalPromise 48 }, 49 showModal() { 50 // éè¦çmodalåå¤å¥½æè½è°ç¨ 51 this.initModal().then(() => this.modal.showModal()) 52 }, 53 /** æ¥æ¾å¹é ç»æ */ 54 changeSearch(id) { 55 const list = [] 56 this.is_default = id === 0 57 _this.attrList.forEach(item => { 58 const data = item.filter(child => child.id === id) 59 list.push(...data) 60 }) 61 if (list.length > 0) this.$set(this.result, 'content', list[0].content) 62 if (id === 0) window.app.info.productDetail.is_match_paramter = 1 63 else if (list.length === 0 && id > 0) window.app.info.productDetail.is_match_paramter = 0 64 else if (list.length > 0 && id > 0) window.app.info.productDetail.is_match_paramter = 1 65 this.$set(this.result, 'status', !!list.length) 66 window.app.info.renderDetailView() 67 } 68 } 69 }) 70 } 71}
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.