SuiteScript2.0 - 包括自定义文件
SuiteScript2.0 - Including a custom file
我正在使用 suitescript 2.0 (netsuite),我想知道如何使用它的新 API 来包含自定义 class(对象) .例如,我试图包含一个控制器 class 但收到 "module not found" 警告。请参阅下面的代码段
/**
*@NApiVersion 2.x
*@NScriptType Restlet
*/
define(['N/record', 'N/error', "src/My_Controller"],
function (record, error, My_Controller) {
var controller = new My_Controller();
...
错误消息是:Module does not exist: src/My_Controller.js
,但实际上它在那里。这是正确的方法吗?
NetSuite 帮助中心没有包含 custom/ancillary javascript
您通过文件柜中的路径引用自定义模块。这可以是相对于当前文件或相对于文件柜的根目录。所以它看起来像:
define(['N/record', 'N/error', '/SuiteScripts/my-project/src/My_Controller'], ...)
或:
define(['N/record', 'N/error', './src/My_Controller'], ...)
假设 src
与此文件位于同一目录中。
我正在使用 suitescript 2.0 (netsuite),我想知道如何使用它的新 API 来包含自定义 class(对象) .例如,我试图包含一个控制器 class 但收到 "module not found" 警告。请参阅下面的代码段
/**
*@NApiVersion 2.x
*@NScriptType Restlet
*/
define(['N/record', 'N/error', "src/My_Controller"],
function (record, error, My_Controller) {
var controller = new My_Controller();
...
错误消息是:Module does not exist: src/My_Controller.js
,但实际上它在那里。这是正确的方法吗?
NetSuite 帮助中心没有包含 custom/ancillary javascript
您通过文件柜中的路径引用自定义模块。这可以是相对于当前文件或相对于文件柜的根目录。所以它看起来像:
define(['N/record', 'N/error', '/SuiteScripts/my-project/src/My_Controller'], ...)
或:
define(['N/record', 'N/error', './src/My_Controller'], ...)
假设 src
与此文件位于同一目录中。