前言
- 最近让我开发个钉钉小程序,以前没整过,料想跟微信小程序差不多,学习下吧。
文档
- ide等资源下载:https://open.dingtalk.com/document/resourcedownload/miniapp-tool
- 钉钉官方组件文档(文档不全):https://open.dingtalk.com/document/orgapp-client/view-container
- 支付宝文档:https://opendocs.alipay.com/mini/component/input
- antd-mini文档:https://mini.ant.design/guide/quick-start
- mini-ali-ui文档:https://opendocs.alipay.com/mini/component-ext/popup
开发注意点
- 钉钉文档不全,属性少了很多,如果不起作用,建议看支付宝的文档。
- 一般测试环境需要再建个企业,在企业中切换就行了。
- 微信小程序我遇见过开发工具显示,预览显示,真机调试3种效果,建议有些场景必须自己真机调试看看是不是那效果。
基本语法
- a冒号开头,这提示器也有问题,经常容易写成v-if导致不起作用。
- 条件 a:if
<view a:if="{{badge!==''}}" >{{badge}}</view>
</view>
- 循环 a:for 默认里面能取到的对象叫item,索引index。
<block a:for="{{list1}}">
{{item.operationSourceName}}
</block>
- 携带点击信息:data-xxx,你就可以在onTap的事件中获得它。
<view onTap="goget" data-item="{{item}}" data-type="{{curTab}}" >
</view>
- 组件json,是组件的带个true,使用到的组件要给位置。
{
"component": true,
"usingComponents": {
"desctiption-input": "/components/description-input/description-input",
"improve-card": "/components/improve-card/improve-card"
}
}
{
"defaultTitle": "sss",
"pullRefresh": false,
"usingComponents": {
"pull-down-refresh": "/components/pull-down-refresh/pull-down-refresh"
}
}
- 生命周期里传值只有onLoad能拿到。其他跟微信小程序差不多。