Vue 英雄列表搜索与排序功能实现

Vue.js 英雄列表搜索与排序功能实现

DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>英雄列表搜索与排序title>
    
    <script src="../js/vue.js">script>
head>

<body>
    
    <div id="app">
        
        <input type="text" placeholder="请输入搜索内容" v-model="keyword">
        <br>
        
        <button @click="type=1">升序button>
        <button @click="type=2">降序button>
        <button @click="type=3">原序button>
        
        
        <table border="1px">
            <tr>
                <th>序号th>
                <th>名字th>
                <th>能量th>
            tr>
            
            <tr v-for="hero in newArr" :key="hero.id">
                <td>{
  {hero.id}}td>
                <td>{
  {hero.name}}td>
                <td>{
  {hero.power}}td>
            tr>
        table>
    div>

    <script>
        // 创建Vue实例
        new Vue({
     
            el: "#app"

你可能感兴趣的:(Vue,vue.js,前端,javascript)