当前位置:网站首页>Adding, deleting, modifying and checking in low build code
Adding, deleting, modifying and checking in low build code
2022-06-25 00:06:00 【Low code preacher】
In daily teaching , People often ask , How to use this platform method , How to pass parameters . In this article, we will explain how to use the method of adding, deleting, modifying, and checking in the low-level code of micro build .
Data source method
After you create the data source , The platform will automatically generate corresponding methods .
Model methods are added respectively 、 Add multiple 、 Delete 、 Delete multiple 、 to update 、 Update multiple 、 Inquire about 、 Query list .
To use these platform methods, you must understand the input and output parameters of each method . The so-called input parameters are the parameters that you must pass in when calling , The so-called parameter output is the result returned after the call .
The new method
Generally, we need to pass the fields of the data source , For example, my grade data source has only one field , Grade name , Then you need to pass in the field of grade name when calling .
There are two ways to call the methods of the general data model , One is to call... In a component , One is to call... In a low code editor .
We usually use it in combination with the form container , For example, add a form container , You can choose to add a new scene , Set data source . The new scenario here refers to calling the new method .
This will save the value to the data source after you enter it in the text box .
The second method is to call... In the low code editor , The following code
export default async function({
event, data}) {
const result = await app.cloud.callModel({
name:'nj_popsnzw',
methodName:'wedaCreate',
params:{
njmc : ' In grade one '
}
})
}

After the method is defined, you can call... By defining a click event for the button 
Except the way you write code , We can also call platform methods directly , Pass on the reference 
Novices are mainly stuck in how to pass parameters when learning , In fact, it is the same as what we pass in the code params It's the same , It's just a visual way to transfer parameters , Remember to bind with expressions here 
Add multiple
You can add multiple items in batch at one time , Notice that our input parameter is an array 
We have not added more than one scenario in the form container , So you have to call... In code
export default async function ({
event, data }) {
const result = await app.cloud.callModel({
name: 'nj_popsnzw',
methodName: 'wedaBatchCreate',
params: {
records: [
{
njmc: ' Batch grade one ' },
{
njmc: ' Batch grade 2 ' },
{
njmc: ' Batch third grade ' }
]
}
})
}
Some students may say , I can't understand what you are . Because the input parameter must be an object , there records It's the input of the method , The type is array , But why are there multiple objects in the array ? You can actually look at the documentation of cloud development , You can't do it just by looking at it .
Delete
Deletion can only be called through low code methods , The code is as follows
export default async function({
event, data}) {
const result = await app.cloud.callModel({
name:'nj_popsnzw',
methodName:'wedaDelete',
params:{
_id : '058dfefe62b50cb70a3d3053309efc79'
}
})
}
Delete multiple
export default async function ({
event, data }) {
const result = await app.cloud.callModel({
name: 'nj_popsnzw',
methodName: 'wedaBatchDelete',
params: {
where: [
{
key: 'njmc',
rel: 'eq',
val: ' Batch grade one '
}
]
}
})
}
to update
Component calls are supported when updating , Low code calls are also supported . Component calls can use the form container 
To update, you must pass in a data ID . The same is true for code calls, which also need to pass in the data ID
export default async function ({
event, data }) {
const result = await app.cloud.callModel({
name: 'nj_popsnzw',
methodName: 'wedaUpdate',
params: {
_id:'6d85a2b962b50bb60c5c73ad0271a82e',
njmc: ' In grade one 11'
}
})
}
Update multiple
export default async function ({
event, data }) {
const result = await app.cloud.callModel({
name: 'nj_popsnzw',
methodName: 'wedaBatchUpdate',
params: {
record: {
njmc: ' Batch update '
},
where: [
{
key: 'njmc', rel: 'eq', val: ' In grade one ' }
]
}
})
}
Inquire about
export default async function ({
event, data }) {
const result = await app.cloud.callModel({
name: 'nj_popsnzw',
methodName: 'wedaGetItem',
params: {
_id: '0ab5303b62b412680acbf05573660730'
}
})
console.log(result)
}
Query list
Query lists can be used in variables 、 Use in components 、 Use in low code . The following is how to use low code
export default async function ({
event, data }) {
const result = await app.cloud.callModel({
name: 'user_h4la7ee',
methodName: 'wedaGetRecords',
params: {
"where": [
{
"key": "openid",
"rel": "eq",
"val": app.dataset.state.openid
}
]
}, // Methods into the reference
});
}
summary
The method of using data source for low code is not complicated , I don't know how to construct the input parameter , This article lists the input parameters of each method in detail , Hope to bring a touch of light to your programming path .
边栏推荐
- Hello C (V) -- pointer and array
- Leetcode No.10 regular expression matching
- Hello C (VII) - structure
- 微搭低代码中实现增删改查
- Using external Libpcap library on ARM platform
- Investment analysis and prospect forecast report of global and Chinese propargyl chloride industry from 2022 to 2028
- Current situation analysis and development trend forecast report of global and Chinese acrylonitrile butadiene styrene industry from 2022 to 2028
- Collective example
- OTT营销之风正盛,商家到底该怎么投?
- 在滴滴和字节跳动干了 5年软件测试,太真实…
猜你喜欢

U.S. House of Representatives: digital dollar will support the U.S. dollar as the global reserve currency

Stm32f030f4 reading infrared remote control data

抖音實戰~項目關聯UniCloud

微搭低代码中实现增删改查

svg+js键盘控制路径

同济、阿里获CVPR最佳学生论文,李飞飞获黄煦涛奖,近6000人线下参会

openGauss内核:简单查询的执行

Ultra vires vulnerability & Logic vulnerability (hot) (VIII)

Hello C (IV) -- pointer and function

What is the difference between one way and two way ANOVA analysis, and how to use SPSS or prism for statistical analysis
随机推荐
Monotone stack and its application
Why do more and more physical stores use VR panorama? What are the advantages?
Analysis report on operation mode and future development of global and Chinese methyl cyclopentanoate industry from 2022 to 2028
微搭低代码中实现增删改查
QT cannot be edited with UTF-8
Arbitrary file download of file operation vulnerability (7)
JPA learning 1 - overview, JPA, JPA core annotations, JPA core objects
Creative SVG ring clock JS effect
美国众议院议员:数字美元将支持美元作为全球储备货币
Dynamic effect of canvas lines
Hello C (two) -- use of bit operation
人体改造 VS 数字化身
[figure database performance and scenario test sharp tool ldbc SNB] series I: introduction to data generator & Application to ges service
Analysis report on the development trend and Prospect of cetamide industry in the world and China from 2022 to 2028
Hibernate学习2 - 懒加载(延迟加载)、动态SQL参数、缓存
磁带svg动画js特效
svg线条动画背景js特效
openGauss内核:简单查询的执行
C# Winform 最大化遮挡任务栏和全屏显示问题
Analysis report on development trend and investment forecast of global and Chinese D-leucine industry from 2022 to 2028