当我单击侧边栏外部的内容时,我想分别关闭它们from urllib.request import urlopen
from bs4 import BeautifulSoup
url = 'https://www.ouedkniss.com/telephones'
html = urlopen(url)
bs = BeautifulSoup(html, 'html.parser')
text_tag = bs.find('span', class_="annonce_get_description",
itemprop="description")
inner_html = text_tag.encode_contents()
inner_html = inner_html.replace(b'<br/>', b'|br|')
bs = BeautifulSoup(inner_html, 'html.parser')
words = bs.text.split('|br|')
print(words)
和sidebar
。目前,我可以通过主布局上的main-layout
来做到这一点,但问题是像div这样的每个元素甚至都没有@click.self
事件也没有响应,这很麻烦,因为我的内容居住在另一个div内。
答案 0 :(得分:1)
如果仅在主布局上使用@click,则该操作应该与对子元素的任何单击一起使用,因为单击仍然会传播到父元素?