Coder Social home page Coder Social logo

Comments (5)

codeskyblue avatar codeskyblue commented on August 15, 2024

sorry, it works for me

from gohttpserver.

hoogw avatar hoogw commented on August 15, 2024

I figure out, the search icon, is broken. not sure why?

If I type 'xxx' at search box top right corner, then click enter, the search works fine.
But if I click the search icon with magnify glass icon, nothing happen.

So need to fix the search icon, attach it to search event.

from gohttpserver.

hoogw avatar hoogw commented on August 15, 2024

Ok, spend 6 hours , finally fix this problem.

This is vue version 1, not 2, so you need to be aware.

The search icon isn't working, you have to do below steps to make click search icon works:

index.js
add function under method:{}

    ` methods: {

   // ------------ search icon clicked event ----------------
     
          search_clicked: function (event) {
            // `this` inside methods points to the Vue instance
          // alert('Hello ' + this.search + '!')
          
          
              var searchParams = new URLSearchParams(window.location.search)
              searchParams.set("search", this.search);
   
    
              // this cause reload  https://stackoverflow.com/questions/5999118/how-can-i-add-or-update-a-query-string-parameter
              //window.location.search = searchParams.toString();

            // to avoid reload
            // var newRelativePathQuery = window.location.pathname + '?' + searchParams.toString();
            //history.pushState(null, '', newRelativePathQuery);

            // here I do want reload, so must use this.
            window.location.search = searchParams.toString();
            
            // no need this, because last line already cause reload.
            // location.reload();
                
                // `event` is the native DOM event
                if (event) {
                // alert(event.target.tagName)

    }
  },`

index.html page, replace search input and icon with this

          ` <!--
          <span class="input-group-btn">
            <button class="btn btn-default" type="button">
              <span class="glyphicon glyphicon-search"></span>
            </button>
          </span>

        <input type="text" name="search" class="form-control" placeholder="Search" v-bind:value="search"
          autofocus>

        -->

        <span class="input-group-btn">
          <button class="btn btn-default" type="button" v-on:click="search_clicked">
            <span class="glyphicon glyphicon-search"></span>
          </button>
        </span>

        
          <input type="text" name="search" class="form-control" placeholder="Search" v-model="search"
          autofocus>

`

from gohttpserver.

hoogw avatar hoogw commented on August 15, 2024

without fix the search icon, you have to click enter key to be able to search.
if you only click search icon, nothing happen.

if you want to make search icon works as well, you have to make 2 change as above I showed you.

from gohttpserver.

codeskyblue avatar codeskyblue commented on August 15, 2024

Sorry for the delay.

from gohttpserver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.