Giter Site home page Giter Site logo

Comments (2)

JuneAndGreen avatar JuneAndGreen commented on June 5, 2024

kbone 中可以直接使用 input,不需要 wx-input,这里兼容到了 html 的 input 标签。然后 web 中的某些事件和小程序事件模型会不同,比如 web 中 input 事件的冒泡处理,所以没有支持这个“返回值替换”的特性。

你的场景我试了下,在 input 标签的 input 事件中修改 evt.currentTarget.value 是表现正常的:

<input type="text" :value="50" @input="onInput" />
onInput(evt) {
      const value = evt.currentTarget.value
      if (parseInt(value, 10) > 50) evt.currentTarget.value = 50
    },

只是这里是异步 setData input 的 value,所以修改过程会闪一下;当然如果你是使用 vue 的话,也可以使用 vue 的 v-model,效果是一样的。

如果你实在需要原生的写法,可以通过 使用小程序自定义组件 的方式,将某些代码用原生编写,然后嵌入到 kbone 页面中。

from kbone.

aa875982361 avatar aa875982361 commented on June 5, 2024

明白

from kbone.

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.