if-else-statement.astro
@@ -1,6 +1,14 @@ | |||
1 | + | --- | |
2 | + | var UserLogin = false | |
3 | + | --- | |
4 | + | ||
5 | + | <!-- Use this method if the results only returns "true" or "false" --> | |
6 | + | {UserLogin ? <p>Log Out</p> : <p>Sign in</p>} | |
7 | + | ||
8 | + | <!-- Use this method if the results return other results that are not labeled as "true" or "false --> | |
1 | 9 | { | |
2 | 10 | ()=> { | |
3 | - | if (user.login === true) { | |
11 | + | if (UserLogin === "external") { | |
4 | 12 | return <p>Log Out</p> | |
5 | 13 | } else { | |
6 | 14 | return <p>Sign In</p> |
Korbs 已修改 . 還原成這個修訂版本
1 file changed, 9 insertions
if-else-statement.astro(檔案已創建)
@@ -0,0 +1,9 @@ | |||
1 | + | { | |
2 | + | ()=> { | |
3 | + | if (user.login === true) { | |
4 | + | return <p>Log Out</p> | |
5 | + | } else { | |
6 | + | return <p>Sign In</p> | |
7 | + | } | |
8 | + | } | |
9 | + | } |
上一頁
下一頁