黄
|
{
"name":
"xuanxuan-ext",
"displayName":
"
群消息置顶
",
"version":
"1.0.0",
"description":
"
允许在群消息中选择某条消息置顶
",
"main":
"index.js",
"publisher":
"Samuel Studio",
"scripts": {
"test":
"npm run test"
},
"repository": {
"type":
"git",
"url":
"http://180.178.55.164:8099/samuel/xuanxuanExt.git"
},
"keywords": [
"xuanxuanim"
],
"author":
"Samuel",
"license":
"WTFPL",
"xext" : {
"type" :
"plugin",
"hot":
true
},
"engines": {
"xuanxuan":
"^3.0",
"platform":
"electron,nwjs"
},
"usesPermissions" : [
"components",
"contextmenu"
]
}
这个是package.json的配置.
const
Modal = require(
'xext/components/Modal');
let
timerTask;
module.
exports = {
onAttach:(ext) => {
console.
log(
`samuel project attached....`)
timerTask =
setTimeout(() => {
Modal.
alert(
'
扩展加载完成已经
10
秒钟了,刚刚加载等扩展名称是:
' + ext.
displayName);
},
10 *
1000);
},
contextMenuCreators : [
{
match :
'message.text',
create: context =>{
const {
message} = context;
const
messageContent =
message.
content;
return [
{
icon:
'mdi-start',
label :
"
在对话框显示消息
",
click : ()=>{
console.
log(
`samuel project
在对话框显示消息
....`)
Modal.
alert(
messageContent)
}
}
]
}
}
]
}
开发板暄暄加载后弹出权限确认界面, 点击确认后成功安装本地插件. 但是在刷新之后载入的时候使用报错:
Call extension api "components.Modal" failed, because the extension "xuanxuan-ext" has not permission to access the api.
我明明已经授权了啊, 为什么还会有这个错误.
|
喧喧-Bee
|
应该已经在交流群沟通过了,这块有个权限控制的: https://www.xuanim.com/book/dev/257.html 扩展 API 根据权限的不同划分为 7 个等级,等级越高的 API 拥有的权限更高,能够实现更复杂的功能。在 “基础版” 授权中客户端扩展可以使用 等级 5 及小于等级 5 下的所有 API,在 “增强版” 和 “OEM” 版本中客户端扩展可以使用所有等级的扩展 API。
|
联系我们
社群交流
微信公众号
QQ群
