当前位置:网站首页>如何開發引入小程序插件
如何開發引入小程序插件
2022-07-05 22:00:00 【InfoQ】
1、小程序插件引入
2 添加插件
3 引入插件代碼包
{
"plugins": {
"myPlugin": {
"version": "1.0.0",
"provider": "插件 id"
}
}
}4在分包內引入插件代碼包
{
"subpackages": [
{
"root": "packageA",
"pages": [
"pages/cat",
"pages/dog"
],
"plugins": {
"myPlugin": {
"version": "1.0.0",
"provider": "插件 id"
}
}
}
]
}- 僅能在這個分包內使用該插件;
- 同一個插件不能被多個分包同時引用;
5使用插件
6自定義組件
{
"usingComponents": {
"hello-component": "plugin://myPlugin/hello-component"
}
}- 默認情况下,頁面中的 this.selectComponent 接口無法獲得插件的自定義組件實例對象;
- ft.createSelectorQuery 等接口的 >>> 選擇器無法選入插件內部。
7頁面
<navigator url="plugin://myPlugin/hello-page">
Go to pages/hello-page!
</navigator>8 js 接口
var myPluginInterface = requirePlugin('myPlugin');
myPluginInterface.hello();
var myWorld = myPluginInterface.world;var myPluginInterface = requirePlugin('插件 id');9導出到插件
{
"myPlugin": {
"version": "1.0.0",
"provider": "插件 id",
"export": "index.js"
}
}// index.js
module.exports = { whoami: 'MiniProgram' }// plugin
requireMiniProgram().whoami // 'MiniProgram'10為插件提供自定義組件
<!-- miniprogram/page/index.fxml -->
<plugin-view generic:mp-view="comp-from-miniprogram" />{
"myPlugin": {
"provider": "插件 id",
"version": "1.0.0",
"genericsImplementation": {
"plugin-index": {
"mp-view": "components/comp-from-miniprogram"
}
}
}
}边栏推荐
- ESP32
- Database tuning solution
- Code bug correction, char is converted to int high-order symbol extension, resulting in changes in positivity and negativity and values. Int num = (int) (unsigned int) a, which will occur in older com
- 怎么利用Tensorflow2进行猫狗分类识别
- Ad637 notes d'utilisation
- HDU 4391 Paint The Wall 段树(水
- 如何开发引入小程序插件
- The solution to the problem that Oracle hugepages are not used, causing the server to be too laggy
- The American Championship is about to start. Are you ready?
- Deeply convinced plan X - network protocol basic DNS
猜你喜欢

Advantages and disadvantages of the "Chris Richardson microservice series" microservice architecture

华为快游戏调用登录接口失败,返回错误码 -1

Create a virtual machine on VMware (system not installed)

MMAP learning

Official clarification statement of Jihu company

华为云ModelArts文本分类–外卖评论

"Chris Richardson microservices series" uses API gateway to build microservices

总结出现2xx、3xx、4xx、5xx状态码的原因

Scenario interview: ten questions and ten answers about distributed locks

K210 learning notes (IV) k210 runs multiple models at the same time
随机推荐
Storage optimization of performance tuning methodology
Efficiency difference between row first and column first traversal of mat data types in opencv
从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
华为快游戏调用登录接口失败,返回错误码 -1
Matlab | app designer · I used Matlab to make a real-time editor of latex formula
Codeforces 12D ball tree array simulation 3 sorting elements
Some common processing problems of structural equation model Amos software
Gcc9.5 offline installation
微服务入门(RestTemplate、Eureka、Nacos、Feign、Gateway)
极狐公司官方澄清声明
Microservice link risk analysis
Summary of El and JSTL precautions
Summary of data analysis steps
QML reported an error expected token ";", expected a qualified name ID
Multiplexing of Oracle control files
Advantages and disadvantages of the "Chris Richardson microservice series" microservice architecture
每日刷题记录 (十四)
Database recovery strategy
Defect detection - Halcon surface scratch detection
Sorting out the problems encountered in MySQL built by pycharm connecting virtual machines