Comments (6)
This is what I came up with. Not any better looking, but no spread. It would be nice if .sync
can be supported natively in jsx.
<VDataTable
pagination={this.pagination}
on={
{
"update:pagination": newVal ⇒ (this.pagination = newVal)
}
}
from jsx-vue2.
the
onUpdate:myprop
oron-update:myprop
should work, if you have issues with that open another issue
onUpdate:prop does not work. should a new issue be filed or can this one be reopened?
from jsx-vue2.
You don't have to use JSX spread to do this.
You can use the syntax below, which calls an anonymous function when the change event is triggered.
<MyComponent myprop={this.myprop} on-change={(val)=> {this.myprop = val; }} />
However, a better way would be to use the v-model directive. Usually, this is attached to the input
event, but it has a lazy
modifier that binds to the change
event instead:
<MyComponent v-model_lazy={this.myprop} />
from jsx-vue2.
Sorry, I should clarify that this is in the case where myprop
is not the component's model. For example, Vuetify's pagination
prop on their data tables.
from jsx-vue2.
Ah, I see. I don't think .sync
is supported directly, but manually listening to the update events should work, assuming it is being emitted in the component.
Have you tried:
<MyComponent myprop={this.myprop} on-update:myprop={(val) => { this.myprop = val; }}
The :
character might be a bit tricky, I haven't tried listening to emitted events in this way. I'd also suggest trying on-update_myprop
and on-updatemyprop
in case these are being handled.
You could also change the emitted event name to remove the colon character.
Other than that, spread may be the only way at the moment.
from jsx-vue2.
the onUpdate:myprop
or on-update:myprop
should work, if you have issues with that open another issue @Dylan-Chapman
from jsx-vue2.
Related Issues (20)
- Error in binding keyboard
- To give a ref to the JSX Element but I cannot get it by $refs. why?
- Include License File
- Vue 2.7 compatibility HOT 6
- 无法在vue2.7的setup中使用jsx HOT 17
- 无法在vue2.7的中使用ref获取dom,以及组件实例。 HOT 4
- scoped css not working with compositionAPI enabled and functional component using render HOT 1
- 迁移composition-api过程中无法兼容method和setup的injectH
- 创建的jsx文件导入到另一jsx中,导出小写不提示,大写提示非jsx HOT 1
- jsx 无法监听鼠标移入移除事件
- 两个preset都使用“sugar-inject-h”这个插件导致duplicate declaration h HOT 1
- 我用 map return 一组 tag div, 每个 div 中再用 ref 标记一个组件,最后得到的是一个 object, 我希望的到的是数组 HOT 3
- web component slot not work
- i want to know that how to use v-slot instead slot directive in jsx-vue2 HOT 4
- v-model compile error on playgroud
- bug:显式import render函数时不应该将其转化为h() , 请在转换时判断是否在vue组件的上下文中,或者是否是vue格式文件
- Modifiers _capture doesn't work with el-col of ElementUi HOT 2
- Cannot parse a prop that starts with _
- 在 Rspack 中无法正常工作
- 在vue2.7.16中使用@vue/babel-sugar-functional-vue,无法转换functional组件
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsx-vue2.