我已经按照文档中的说明复制并粘贴了mdc-text-field-outlined的标记,还根据需要进行了JS实例化/初始化,并导入了样式。但是没有渲染。
标记:
#Converts list of tuples to dictionary.
#[('a',1'),('b',2)] => {'a':1,'b',2}
def tupleListToDict(list):
dictobj = {}
for item in list:
dictobj[item[0]] = item[1]
return dictobj
def findSimilarities(list1, list2):
dict1 = tupleListToDict(list1)
dict2 = tupleListToDict(list2)
dict3 = {} #To store the difference
#Find occurence of key in 2nd dict, if found, calculate the difference
for key, value in dict1.items():
if key in dict2.keys():
dict3[key] = abs(value - dict2[key])
return dict3
JS(在login.js中):
list1 = [('brexit', 11), ('say', 11), ('uk', 7), ('eu', 6), ('deal', 5), ('may', 5)]
list2 = [('brexit', 35), ('say', 28), ('may', 5), ('uk', 1)]
print(findSimilarities(list1, list2))
{'brexit': 24, 'say': 17, 'uk': 6, 'may': 0}
样式(在login.scss中):
<div class="mdc-text-field mdc-text-field--outlined username">
<input type="text" id="tf-outlined" class="mdc-text-field__input">
<div class="mdc-notched-outline">
<div class="mdc-notched-outline__leading"></div>
<div class="mdc-notched-outline__notch">
<label for="tf-outlined" class="mdc-floating-label">Username</label>
</div>
<div class="mdc-notched-outline__trailing"></div>
</div>
</div>
当我使用填充的文本字段标记时,它可以工作,但不能显示轮廓。