App.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div class="main-grid">
  3. <div class="head">2PPS
  4. <form>
  5. <input type="text" ref="my_input">
  6. <button @click.prevent="submitTweet()">Submit</button>
  7. </form>
  8. </div>
  9. <div class="topicLists">
  10. <topicLists id="topicLists"></topicLists>
  11. </div>
  12. <div class="tweets">
  13. <ul>
  14. <Tweet
  15. v-for="(tweet, index) in tweets"
  16. :key="tweet.id"
  17. :topics="tweet.topics"
  18. :text="tweet.text"
  19. ></Tweet>
  20. </ul>
  21. </div>
  22. </div>
  23. <div class="ArchivedTweets">
  24. </div>
  25. </template>
  26. <script>
  27. import topicLists from './components/TopicLists.vue'
  28. import Tweet from './components/Tweet.vue'
  29. export default {
  30. components: { Tweet },
  31. data() {
  32. return {
  33. tweetToSubmit: '',
  34. tweets : [
  35. {
  36. id: 1,
  37. topics: "house",
  38. text: "asd"
  39. },
  40. {
  41. id: 2,
  42. topics: "mouse",
  43. text: "asdds"
  44. }
  45. ]
  46. }
  47. },
  48. methods: {
  49. submitTweet () {
  50. this.tweetToSubmit = this.$refs.my_input.value
  51. }
  52. }
  53. }
  54. </script>
  55. <style>
  56. @import './assets/base.css';
  57. header {
  58. line-height: 1.5;
  59. text-align: center;
  60. font-size: large;
  61. }
  62. .topicLists {
  63. float : left;
  64. margin: 0 1.5%;
  65. width: 30%;
  66. }
  67. .tweets {
  68. float : left;
  69. margin: 0 1.5%;
  70. width: 30%;
  71. }
  72. </style>