当前位置:网站首页>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 .
边栏推荐
- OTT营销之风正盛,商家到底该怎么投?
- QT cannot be edited with UTF-8
- Current situation and development prospect forecast report of global and Chinese tetrahydrofurfuryl alcohol acetate industry from 2022 to 2028
- Opengauss kernel: simple query execution
- Classic interview questions and answers for embedded engineers
- svg线条动画背景js特效
- Hello C (IV) -- pointer and function
- openGauss内核:简单查询的执行
- What are the advantages of VR panoramic production? Why is it favored?
- China CAE industry investment strategic planning and future development analysis report 2022 ~ 2028
猜你喜欢
随机推荐
技术分享| WVP+ZLMediaKit实现摄像头GB28181推流播放
Hello C (VII) - structure
Arbitrary file download of file operation vulnerability (7)
C# Winform 最大化遮挡任务栏和全屏显示问题
Im instant messaging development application keeping alive process anti kill
Analysis report on the development trend and Prospect of cetamide industry in the world and China from 2022 to 2028
JPA学习2 - 核心注解、注解进行增删改查、List查询结果返回类型、一对多、多对一、多对多
VR全景怎么赚钱?结合市场从两个方面客观分析下
Creative SVG ring clock JS effect
Is there really something wrong with my behavior?
Analysis report on the "fourteenth five year plan" and development trend of China's engineering project management industry from 2022 to 2028
【面试题】instancof和getClass()的区别
It's 2022, and you still don't know what performance testing is?
∞ symbol line animation canvasjs special effect
JDBC —— 数据库连接
信号完整性(SI)电源完整性(PI)学习笔记(一)信号完整性分析概论
svg线条动画背景js特效
Hello C (V) -- pointer and array
Hibernate learning 2 - lazy loading (delayed loading), dynamic SQL parameters, caching
浅析大型IM即时通讯系统开发难度









