亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

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

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

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

問題描述

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

<link rel='import' href='http://www.aoyou183.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 v在线影院 | 国产va精品网站精品网站精品 | 日韩亚洲人成在线综合日本 | 免费观看很黄很色的大片 | 久久精品无遮挡一级毛片 | 久久99爰这里有精品国产 | 91尤物国产尤物福利 | 女人洗澡一级特黄毛片 | 午夜精品久视频在线观看 | 大插香蕉| 中国精品视频一区二区三区 | 国产麻豆视频在线观看 | www色婷婷 | 日韩一区二区三区在线视频 | 青青青免费网站在线观看 | 精品国产福利第一区二区三区 | 一区二区三区久久精品 | 香蕉tv亚洲专区在线观看 | 在线观看亚洲精品专区 | 久久亚洲成人 | 国产精品素人搭讪在线播放 | 亚洲理论片中文字幕电影 | 亚洲高清成人欧美动作片 | 日韩永久在线观看免费视频 | 丁香六月纪婷婷激情综合 | 日韩欧美一二三 | 久久国产免费福利永久 | 国内自拍区 | 久久99精品久久久久子伦小说 | 欧美一区二区三区四区在线观看 | 国产青青在线 | 亚洲综合另类 | 高清一级做a爱免费视 | 同性男男黄h片在线播放免费 |