App.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <div class="container">
  3. <div class="toppane">
  4. <form>
  5. <h1 style="font-size: medium;">Input like: "text#topic1#topic2"</h1>
  6. <input type="text" ref="my_input" id="tweetInput">
  7. <button @click.prevent="submitTweet()">Submit</button>
  8. </form>
  9. </div>
  10. <div class="leftpane"> Placeholder
  11. <div class="tabs"></div>
  12. <ol>
  13. <li v-for="topic in topicList">
  14. <input type="checkbox" :id="topic.topic" :value="topic.topic" v-model="selectedTopics">
  15. <label :for="topic.topic">{{topic.topic}}</label>
  16. </li>
  17. </ol>
  18. </div>
  19. <div class="middlepane">
  20. <ul>
  21. <Tweet
  22. v-for="(tweet, index) in tweets"
  23. :key=index
  24. :topics="tweet.topics"
  25. :text="tweet.text"
  26. ></Tweet>
  27. </ul>
  28. </div>
  29. <div class="rightpane">
  30. <h1>placeholder</h1>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. import Tweet from './components/Tweet.vue'
  36. export default {
  37. components: { Tweet },
  38. data: function() {
  39. return {
  40. tweetToSubmit: '',
  41. tweets : [
  42. {
  43. topics: "#house #mouse",
  44. text: "I am a house in a mouse"
  45. },
  46. {
  47. topics: "#sports",
  48. text: "Lets go my team"
  49. }
  50. ],
  51. topicList : [
  52. { topic: "house" },
  53. { topic: "mouse" },
  54. { topic: "sports" },
  55. ],
  56. selectedTopics: [],
  57. }
  58. },
  59. methods: {
  60. submitTweet () {
  61. this.tweetToSubmit = this.$refs.my_input.value
  62. document.getElementById('tweetInput').value = ''
  63. }
  64. }
  65. }
  66. </script>
  67. <style>
  68. @import './assets/base.css';
  69. body, html {
  70. width: 100%;
  71. height: 100%;
  72. margin: 0;
  73. }
  74. .container {
  75. width: 100%;
  76. height: 100%;
  77. }
  78. .leftpane {
  79. width: 25%;
  80. height: 100%;
  81. float: left;
  82. background-color: rosybrown;
  83. border-collapse: collapse;
  84. }
  85. .middlepane {
  86. width: 50%;
  87. height: 100%;
  88. float: left;
  89. border-collapse: collapse;
  90. }
  91. .rightpane {
  92. width: 25%;
  93. height: 100%;
  94. position: relative;
  95. float: right;
  96. background-color: yellow;
  97. border-collapse: collapse;
  98. }
  99. .toppane {
  100. margin-top: 10px;
  101. width: 100%;
  102. height: 100px;
  103. border-collapse: collapse;
  104. }
  105. form {
  106. text-align: center;
  107. }
  108. </style>