当前位置:网站首页>How to develop and introduce applet plug-ins
How to develop and introduce applet plug-ins
2022-07-05 22:01:00 【InfoQ】
1、 Applet plug-ins are introduced
2 Add the plug-in
3 Introduce plug-in code package
{
"plugins": {
"myPlugin": {
"version": "1.0.0",
"provider": " plug-in unit id"
}
}
}
4 Introduce plug-in code package into subcontracting
{
"subpackages": [
{
"root": "packageA",
"pages": [
"pages/cat",
"pages/dog"
],
"plugins": {
"myPlugin": {
"version": "1.0.0",
"provider": " plug-in unit id"
}
}
}
]
}
- The plug-in can only be used within this Subcontract ;
- The same plug-in cannot be referenced by multiple subcontractors at the same time ;
5 The use of plug-in
6 Custom components
{
"usingComponents": {
"hello-component": "plugin://myPlugin/hello-component"
}
}
- By default , On the page this.selectComponent The interface cannot get the custom component instance object of the plug-in ;
- ft.createSelectorQuery And so on >>> The selector cannot be selected inside the plug-in .
7 page
<navigator url="plugin://myPlugin/hello-page">
Go to pages/hello-page!
</navigator>
8 js Interface
var myPluginInterface = requirePlugin('myPlugin');
myPluginInterface.hello();
var myWorld = myPluginInterface.world;
var myPluginInterface = requirePlugin(' plug-in unit id');
9 Export to plug-in
{
"myPlugin": {
"version": "1.0.0",
"provider": " plug-in unit id",
"export": "index.js"
}
}
// index.js
module.exports = { whoami: 'MiniProgram' }
// plugin
requireMiniProgram().whoami // 'MiniProgram'
10 Provide custom components for plug-ins
<!-- miniprogram/page/index.fxml -->
<plugin-view generic:mp-view="comp-from-miniprogram" />
{
"myPlugin": {
"provider": " plug-in unit id",
"version": "1.0.0",
"genericsImplementation": {
"plugin-index": {
"mp-view": "components/comp-from-miniprogram"
}
}
}
}
边栏推荐
- Exercise 1 simple training of R language drawing
- How to organize an actual attack and defense drill
- NET中小型企业项目开发框架系列(一个)
- "Chris Richardson microservices series" uses API gateway to build microservices
- Cross end solutions to improve development efficiency
- The solution to the problem that Oracle hugepages are not used, causing the server to be too laggy
- 从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
- 极狐公司官方澄清声明
- DataGrid directly edits and saves "design defects"
- Decorator learning 01
猜你喜欢
[Yugong series] go teaching course in July 2022 004 go code Notes
微服务入门(RestTemplate、Eureka、Nacos、Feign、Gateway)
Drawing HSV color wheel with MATLAB
Blocking protocol for concurrency control
Database recovery strategy
An exception occurred in Huawei game multimedia calling the room switching method internal system error Reason:90000017
The Blue Bridge Cup web application development simulation competition is open for the first time! Contestants fast forward!
Experienced inductance manufacturers tell you what makes the inductance noisy. Inductance noise is a common inductance fault. If the used inductance makes noise, you don't have to worry. You just need
华为云ModelArts文本分类–外卖评论
Concurrency control of performance tuning methodology
随机推荐
Kingbasees v8r3 data security case - audit record clearing case
[Yugong series] go teaching course in July 2022 004 go code Notes
资深电感厂家告诉你电感什么情况会有噪音电感噪音是比较常见的一种电感故障情况,如果使用的电感出现了噪音大家也不用着急,只需要准确查找分析出什么何原因,其实还是有具体的方法来解决的。作为一家拥有18年品牌
Business learning of mall order module
Overview of concurrency control
[Yugong series] go teaching course 003-ide installation and basic use in July 2022
854. 相似度为 K 的字符串 BFS
Performance monitoring of database tuning solutions
MMAP学习
Two stage locking protocol for concurrency control
ICMP introduction
AD637使用筆記
Ad637 notes d'utilisation
华为联机对战如何提升玩家匹配成功几率
R language learning notes
database mirroring
Analysis and test of ModbusRTU communication protocol
Analyse des risques liés aux liaisons de microservices
Emotional analysis of wechat chat records on Valentine's day based on Text Mining
2.2.3 output of documents