Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| dad_jokes [2025/03/02 17:48] – Scott Larson | dad_jokes [2025/06/26 01:44] (current) – removed Scott Larson | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Joke Generator ====== | ||
| - | |||
| - | < | ||
| - | < | ||
| - | <meta charset=" | ||
| - | < | ||
| - | <script src=" | ||
| - | < | ||
| - | body { | ||
| - | font-family: | ||
| - | background-color: | ||
| - | margin: 50; | ||
| - | padding: 25; | ||
| - | } | ||
| - | |||
| - | #app { | ||
| - | text-align: left; | ||
| - | margin-top: 50px; | ||
| - | margin-left: | ||
| - | } | ||
| - | |||
| - | h1 { | ||
| - | color: #333; | ||
| - | } | ||
| - | |||
| - | button { | ||
| - | background-color: | ||
| - | color: #fff; | ||
| - | border: none; | ||
| - | padding: 20px 40px; | ||
| - | font-size: 16px; | ||
| - | cursor: pointer; | ||
| - | } | ||
| - | |||
| - | button: | ||
| - | background-color: | ||
| - | } | ||
| - | |||
| - | p { | ||
| - | font-size: 16px; | ||
| - | text-align: left; | ||
| - | margin-top: 20px; | ||
| - | color: #555; | ||
| - | max-width: 50%; | ||
| - | } | ||
| - | #title { | ||
| - | display: none; | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| - | |||
| - | < | ||
| - | <div id=" | ||
| - | <h1 id=" | ||
| - | <button @click=" | ||
| - | <p>{{ joke }}</ | ||
| - | </ | ||
| - | |||
| - | < | ||
| - | new Vue({ | ||
| - | el: '# | ||
| - | data: { | ||
| - | joke: '' | ||
| - | }, | ||
| - | methods: { | ||
| - | generateJoke() { | ||
| - | fetch(' | ||
| - | headers: { | ||
| - | ' | ||
| - | } | ||
| - | }) | ||
| - | .then(response => response.json()) | ||
| - | .then(data => { | ||
| - | this.joke = data.joke; | ||
| - | }) | ||
| - | .catch(error => { | ||
| - | console.error(error); | ||
| - | }); | ||
| - | } | ||
| - | } | ||
| - | }); | ||
| - | </ | ||
| - | </ | ||
| - | |||
| - | </ | ||