如何使用 mustache 模板在moodle中创建模态

问题描述

如何使用mustache模板在moodle中创建模态,js必须在一个单独的文件中,我不知道把它放在一起,文档有点难 我在本地插件中执行此操作。 我正在关注文档,我有这个文件结构

├── amd
│   ├── build
│   │   └── modal.min.js
│   └── src
│       └── modal.js
├── classes
│   └── form
│       └── edit.php
├── index.php
├── manage.php
├── styles.css
├── templates
│   └── index.mustache
└── version.php

在 index.php 中我使用这个调用 js

$PAGE->requires->js_call_amd('amd/src/modal','init');

在 modal.js 中,我只有一个控制台日志,但它不打印,我总是收到此错误

define([],function() {
  return {
    init: function() {
      console.log('Hello world');
    },};
});

错误:

ncaught Error: Script error for "amd/srcmodal"
http://requirejs.org/docs/errors.html#scripterror

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...