Comments (7)
@07akioni form.value = { ...formInitValue } 它是可以的
from naive-ui.
The docs have mistakes, I've fixed it.
About resetting, naive-ui doesn't provide a method for reset a form. Form just collect values and do validation to the corresponding form items.
If you want to restore a value. Just implemenet it. For example:
{
setup () {
const formInitValue = { key: 'value' }
const formValueRef = ref({ ...formInitValue })
const resetFormValue = () => { formValueRef.value = formInitValue }
// ...
}
}
from naive-ui.
@07akioni Writing this seems to lead to object double reference problems,
from naive-ui.
@07akioni form.value = { ...formInitValue } 它是可以的
是的,我们这个表格由于实现的比较简陋,内部根本不去收集值,完全是受控的,想恢复就是记录一下初始值的事
from naive-ui.
应该提供这个方法吧 还是经常使用的
from naive-ui.
应该提供这个方法吧 还是经常使用的
提供不了,数据是用户自己控制的,表格改不了这玩意
from naive-ui.
或许可以用 v-model:model 来做一个简单的清除工作,不过 emmm 确实感觉意义不大,省不了多少代码。
用户如果要自己搞这个事其实很简单,只多三行代码
const initialModel = { ... }
setup () {
const modelRef = ref(deepClone(initialModel))
return {
model: modelRef,
reset: () => modelRef.value = deepClone(initialModel)
}
}
from naive-ui.
Related Issues (20)
- show-menu HOT 3
- 【n-select】能不能手动focus的时候,自动将下拉框打开 HOT 2
- 'pnpm lint' results in TypeError: Converting circular structure to JSON HOT 1
- 希望Code组件可以自定义起始行号
- 500 document is not defined when using n-popover in Nuxt3 HOT 3
- 导出excel乱码 HOT 2
- Select组件支持分页异步加载
- n-upload的照片墙功能
- 【Calendar】日历组件希望可以增加一个右上角切换月份的功能区插槽,或者合并到header插槽
- Tab 初始化时无法填值
- Upload 组件 data 属性为函数时,直接获取形参 file.name 返回 undefined HOT 3
- 支持 DataTable 不同列的 filter 结果取并
- [NDataTable] 在没有数据的情况下,不会有横向滚动条 HOT 2
- 上传组件除了图片类型,其他类型缩略图都不生效 HOT 1
- Drawer组件添加一个lazy属性,指定是否懒挂载 HOT 1
- 建议:n-upload组件添加一个重新上传回调方法
- 需求:为Cascader增加API:render-prefix和render-suffix HOT 2
- n-input组件添加失焦后更新值属性 HOT 1
- n-select组件添加失焦后更新值属性 HOT 2
- 组件文档 出现错误 HOT 1
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 naive-ui.