1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
| <body> <div id="app"> 文章分类: <input type="text" v-model="searchConditions.category" /><span>{{searchConditions.category}}</span> 发布状态: <input type="text" v-model="searchConditions.state" /><span>{{searchConditions.state}}</span> <button>搜索</button> <button v-on:click="clear">重置</button> <br /> <br /> <table border="1 solid" colspa="0" cellspacing="0"> <tr> <th>文章标题</th> <th>分类</th> <th>发表时间</th> <th>状态</th> <th>操作</th> </tr> <tr v-for="(article,index) in articleList"> <td>{{article.title}}</td> <td>{{article.category}}</td> <td>{{article.time}}</td> <td>{{article.state}}</td> <td> <button>编辑</button> <button>删除</button> </td> </tr> </table> </div> <script type="module"> import { createApp } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js' createApp({ data() { return { searchConditions: { category: '', state: '' }, articleList: [{ title: "医疗反腐绝非砍医护收入", category: "时事", time: "2023-09-5", state: "已发布" }, { title: "中国男篮缘何一败涂地?", category: "篮球", time: "2023-09-5", state: "草稿" }, { title: "华山景区已受大风影响阵风达7-8级,未来24小时将持续", category: "旅游", time: "2023-09-5", state: "已发布" }] } }, methods: { clear: function () { this.searchConditions.category = ""; this.searchConditions.state = ''; } } }).mount("#app") </script> </body>
|