Code Monkey home page Code Monkey logo

kimzleung.github.io's People

Contributors

kimzleung avatar

Stargazers

Aymax avatar  avatar

Watchers

James Cloos avatar  avatar

kimzleung.github.io's Issues

记录一下一个坑


我在写Vue的Demo的时候

当我想写一个通过一个表单输入来筛选下方v-for渲染的列表信息的组件的时候,我通过了几种方法去实现。(毕竟不知道通常怎么实现比较好)

  • 通过使用v-for="item in items | filterByMsg msg" 这种方式来通过输入的msg的改变来过滤本来的items数组可以成功。自定义过滤器filterByMsg里面传入用户输入的msg值,使用了indexOf
  • 然后尝试使用computed计算属性去通过msg来计算items应该返回的值,过程中使用indexOf失败。。这个方法始终返回-1(不知为何)
  • 然后尝试使用watch来观察msg输入值的变化来改变数组。indexOf也是始终返回0
  • 用自定义事件在父组件触发事件然后传递msg作为参数过去也可以使用indexOf判断啊=。=GG

不知道是不是因为通过props从父组件传递msg到子组件之后indexOf就会炸掉

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.