What's the difference between the `&` and `&&` in Vue.js? [duplicate] - vue.js

This question already has answers here:
What's the difference between & and && in JavaScript?
(4 answers)
Closed 4 years ago.
What's the difference between the & and && in Vue.js?
I test the:
<span
v-if="1 > 0 & 2 > 1"
>
span
</span>
and
<span
v-if="1 > 0 && 2 > 1"
>
span
</span>
both the text span will show.
So is there some difference between them in Vue.js?

They have the same type of logic. 0101 & 1010 = 0000. However && will not valuate the second one if the first on is false, it will always consider the second one true..
try this
<span
v-if="1 > 3 && 2 > 3"
>
span
</span>

Related

How to send text into br element using Selenium

I am trying to make a tiktok bot, but I am having issues entering in text to their caption section(see screenshot below). I've tried using wait till element clickable function, but for some reason I can not use selenium to detect this element, would anyone have any suggestions on how to go about this, thank you in advance :)
My current code is below:
driver.get("https://www.tiktok.com/upload?lang=en")
try:
element = WebDriverWait(driver, waittime).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#root > div > div > div > div > div.jsx-410242825.contents-v2 > div.jsx-2580397738.form-v2 > div.jsx-2580397738.caption-wrap-v2 > div > div:nth-child(1) > div.jsx-1717967343.margin-t-4 > div > div.jsx-1043401508.jsx-723559856.jsx-1657608162.jsx-3887553297.icon-style.hash')))
except:
driver.quit()
element.click()
try:
element = WebDriverWait(driver, waittime).until(EC.presence_of_element_located((By.CSS_SELECTOR, '#root > div > div > div > div > div.jsx-410242825.contents-v2 > div.jsx-2580397738.form-v2 > div.jsx-2580397738.caption-wrap-v2 > div > div:nth-child(1) > div.jsx-1717967343.margin-t-4 > div > div.jsx-1043401508.jsx-723559856.jsx-1657608162.jsx-3887553297.editor > div > div > div > div > div > div > span > span > span')))
except:
driver.quit()
element.clear()
element.send_keys(mainCaption)
Element snapshot:
HTML <br> Tag
The <br> tag inserts a single line break. The <br> tag is an empty tag which means that it has no end tag and is useful for writing addresses or poems to enter line breaks, not to add space between paragraphs. Hence, you can't send any text within a <br> element.
Presumably, <br> tags will have parent/ancestor <p> tags. As an example:
<p>Be not afraid of greatness.<br>
Some are born great,<br>
some achieve greatness,<br>
and others have greatness thrust upon them.</p>
<p><em>-William Shakespeare</em></p>
So in these cases you need to target the parent/ancestor <p> tags to send the text.

How to insert variable as string for a web element attribute value using selenium vba

I am successfully able to click on the element using:
.FindElementByCss("[data-code^='000']", 8000).Click
However, I am wanting to replace the '000' with a variable assigned with the string of "000"
when I try:
Dim codeInList As String
codeInList = "000"
.FindElementByCss("[data-code^= 'codeInList']", 8000).Click
I get element not found
HTML code:
<div class="cell" align="center">
<a class="edit" href="Javascript:" data-code="000">
Edit</a> == $0
</div>
Needed " + & + variable between the '
correct syntax:
.FindElementByCss("a[data-code^='" & codeInList & "']").Click

take text in span data icon selenium vba

I would like to take the text "msg-dblcheck" within this code and insert it into an MSaccess table:
<div class="_32uRw">
<span data-icon="msg-dblcheck" class="">
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 15" width="16" height="15">
<path fill="#92A58C" d="M15.01 3.316l-.478-.372a.365.365 0 0 0-.51.063L8.666 9.879a.32.32 0 0 1-.484.033l-.358-.325a.319.319 0 0 0-.484.032l-.378.483a.418.418 0 0 0 .036.541l1.32 1.266c.143.14.361.125.484-.033l6.272-8.048a.366.366 0 0 0-.064-.512zm-4.1 0l-.478-.372a.365.365 0 0 0-.51.063L4.566 9.879a.32.32 0 0 1-.484.033L1.891 7.769a.366.366 0 0 0-.515.006l-.423.433a.364.364 0 0 0 .006.514l3.258 3.185c.143.14.361.125.484-.033l6.272-8.048a.365.365 0 0 0-.063-.51z"></path>
</svg>
</span>
</div>
this is my tried code:
spnt= bot.findElementByClassName("_32uRw").text
unfortunately I insert field "-1".
Where am I wrong? In selecting the field? Should I search with xpath? Can someone help me?
Do you mean something like:
.FindElementByCss("._32uRw span").Attribute("data-icon")
I don't know how many class names you have before this one though. The above will match on the first by that class name with a following span.
You can do FindElementsByCSS, and index into the returned webElements collection e.g. .FindElementsByCss("._32uRw span")(1).Attribute("data-icon")
With the above you don't need .Text on the end. This would return msg-dblcheck.
For the last element with this attribute:
Dim numElements As Long, lastElement As WebElement
numElements = bot.FindElementsByCss("[data-icon='msg-dblcheck']").Count
Set lastElement = bot.FindElementsByCss("[data-icon='msg-dblcheck']")(numElements-1)
To include the class name of the element before change the text [data-icon='msg-dblcheck'] to ._32uRw [data-icon='msg-dblcheck'] .

return template interpolation within ternary operator in angular 5

How do achieve following in angular 5 template:
<h6>{{userWalletData.BTCWalletBalance ? {{userWalletData.BTCWalletBalance}} BTC = {{userWalletData.BTCWalletBalanceInFiat}} : 'Fetching balance...'}}</h6>
You can use Angular's *ngIf in the template to achieve it.
<h6 *ngIf="userWalletData.BTCWalletBalance != undefined && userWalletData.BTCWalletBalanceInFiat != undefined; else fetching_balance">{{userWalletData.BTCWalletBalance}} BTC = {{userWalletData.BTCWalletBalanceInFiat}}</h6>
<ng-template #fetching_balance><span>Fetching balance...</span></ng-template>
hope it helps!

How to check if a float is lesser than 0 in QWEB report

I want to know if there is a special keyword as alternative to > in QWEB report.
I found gt (maps to >) but it shows the following error message:
QWebException: invalid syntax (, line 1)
Code:
<t t-if="total gt 0">
<t t-esc="total"/>
</t>
You need to use html codes or in this situation you can use the named codes, too.
> = > = >
< = < = <