美文网首页
在Cocos creator中使用微信原生小程序/小游戏的api

在Cocos creator中使用微信原生小程序/小游戏的api

作者: 日拱一卒wu | 来源:发表于2024-01-18 19:57 被阅读0次

准备:

  1. 微信小游戏定义文件
  2. 微信小程序定义文件

小游戏举例:

安装后手动导入:

import 'minigame-api-typings';

一、在项目根目录执行该命令, 生成 node_modules 目录

npm install minigame-api-typings
Screenshot 2024-01-19 at 19.54.04.png

二、安装后手动导入:

import 'minigame-api-typings';

或者在 ts 配置中指定:

  • tsconfig.json 中指定
types: ["minigame-api-typings"]

或者通过 三斜杠指令 引用:

/// <reference path="node_modules/minigame-api-typings/index.d.ts" />
Screenshot 2024-01-19 at 19.56.22.png

相关文章

网友评论

      本文标题:在Cocos creator中使用微信原生小程序/小游戏的api

      本文链接:https://www.haomeiwen.com/subject/deldodtx.html