午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

您的位置:首頁技術文章
文章詳情頁

javascript - 如何用polymer寫一個文件目錄樹?

瀏覽:233日期:2023-04-04 14:09:42

問題描述

前兩天剛看了polymer的基本結構,現在需要用它寫一個文件目錄樹,于是在git上檢索出了一個別人寫tree標簽,但是不知道該如何掉用,希望有深入了解過polymer的大神解答一下,謝謝!一下為該標簽的內容:

<link rel='import' href='http://www.leifengta.com.cn/bower_components/polymer/polymer.html'><dom-module id='iris-treeview'> <template> <style> :host {display: block;position: relative;color: var(--mydoc-brown-1000); } span {cursor: pointer; } iris-treeview:before {content: ’’;display: inline-block;border-top: 2px solid;padding-left: 15px;margin-left: -25px;height: 5px; } .branch {padding-left: 25px;border-left: 2px solid;position: relative; } .branch:last-of-type:after {content: ’’;border-left: 2px solid;position: absolute;top: 10px;bottom: 0;color: white;margin-left: -27px; } .selected {color: var(--mydoc-brown-400); } </style> <content></content> <template is='dom-if' if='[[isBranch]]'> <template is='dom-repeat' items='[[tier]]'><p changed$='[[isChanged(item,switch)]]'> <iris-treeview display-depth='[[down]]' data='[[data]]' selected='{{selected}}' display-leaf='[[displayLeaf]]' path$='[[path]].[[item]]'> <span class$='{{treeviewClass(selected,item)}}' on-click='branchClick'>[[item]]</span> </iris-treeview></p> </template> </template> <template is='dom-if' if='[[isLeaf]]'> <span on-click='leafClick' hidden$='[[!displayLeaf]]'>[[value]]</span> </template> </template> <script> ’use strict’ Polymer({ is: ’iris-treeview’, properties: {data: { type: Object, observer: ’_dataChanged’},displayDepth: { type: Number, value: 10},displayLeaf: { type: Boolean, value: false},path: { type: String, value: ’’},selected: { type: Object, notify: true} }, observers: [’_deepChanged(data.*)’], _deepChanged(data) {this.set(’switch’, !this.switch); }, isChanged(item, s) {return false; }, treeviewClass(sel, item) {return (sel == this.path + ’.’ + item) ? ’selected’ : ''; }, branchClick(e) {console.log(this.path);let item = e.model.item;let branch = this.data[item]let path = this.path + ’.’ + item;this.fire(’select’, { type: ’branch’, value: branch, path: path});this.fire(’select-branch’, { value: branch, path: path});this.set(’selected’, path); }, leafClick(e) {let path = this.path + ’.’ + item;this.fire(’select’, { type: ’leaf’, value: this.value, path: path});this.fire(’select-leaf’, { value: this.value, path: path});this.set(’selected’, path); }, _dataChanged(data) {if (this.displayDepth <= 0) return;this.down = this.displayDepth !== false ? this.displayDepth - 1 : false;let q = this.path.split(’.’);let current = _.slice(q, 1).length ? _.get(this.data, _.slice(q, 1)) : this.data;let branch = true;if (_.isObject(data)) { this.set(’tier’, _.keys(current));} else { branch = !branch; this.set(’value’, data);}this.set(’isBranch’, branch);this.set(’isLeaf’, !branch); }, getTier(item) {return this.data[item] } }); </script></dom-module>

問題解答

回答1:

調用方式正如組件里自引用的方式一樣,傳遞properties,寫children

<iris-treeview display-depth='[[down]]' data='[[data]]' selected='{{selected}}' display-leaf='[[displayLeaf]]' path$='[[path]].[[item]]'> <span class$='{{treeviewClass(selected,item)}}' on-click='branchClick'> [[item]] </span></iris-treeview>

標簽: JavaScript
相關文章:
主站蜘蛛池模板: 国产精品美女久久久久久 | 国产成人精品免费 | 欧美一级艳片视频免费观看 | 日本aⅴ在线 | 国产无遮挡免费视频 | caoporn国产| 日韩成人一区 | 日韩欧美中文字幕在线视频 | 日本特黄一级 | 在线久久 | 国产精品视频在线观看免费 | 亚洲福利在线播放 | 一区二区影院 | 成人精品在线观看 | 午夜色综合 | 久久网免费视频 | 色综合日韩 | 色999视频 | 国产免费一区二区三区最新不卡 | av成人在线看 | 97福利社| 在线观看国产黄 | 日本免费色 | 男人的天堂在线 | 久久久久久国产精品视频 | 日韩在线激情 | 久久成人免费 | 91精品久久香蕉国产线看观看 | 国产午夜精品在线观看 | 蜜色影院 | 懂色av成人一区二区三区 | 久久精品爱| 日韩视频一区二区三区在线播放免费观看 | 国产精品9999 | 日韩在线观看不卡 | 亚洲免费网站 | 91精品推荐| 亚洲激情网 | 久操视频在线播放 | 亚洲成人a√ | 天天草天天干 |