关于super关键字bug

super关键字bug

yield super.setstatusAction('document'); 

 ^^^^^ SyntaxError: 'super' keyword unexpected here at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:139:10) at Module._compile (module.js:616:28) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at exports.interopRequire (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/loader/util.js:14:13) at files.forEach.file (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/loader/common.js:16:26) at Array.forEach (<anonymous>) at Object.loadFiles (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/loader/common.js:12:11) at Object.load (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/loader/common.js:64:32) at Loader.loadController (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/index.js:49:19) at thinkLoader.loadData (/Users/lcz/WebstormProjects/CmsWing/node_modules/thinkjs/lib/loader.js:45:42) at thinkLoader.loadAll (/Users/lcz/WebstormProjects/CmsWing/node_modules/thinkjs/lib/loader.js:110:12) at Application.run (/Users/lcz/WebstormProjects/CmsWing/node_modules/thinkjs/lib/application.js:205:18) at Object.<anonymous> (/Users/lcz/WebstormProjects/CmsWing/development.js:15:10) at Module._compile (module.js:649:14) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32)

2 个回复

  • avatar
    6 个月前 静♥♡置じ☆ve快 乐빠 사
    /**
    * 设置一条或者多条数据的状态
    */​​
    async setstatusAction() {
    const ids = this.para('ids');
    if (think.isEmpty(ids)) {
    return this.fail('请选择要操作的数据');
    }
    const data = await this.model('document').where({id: ['IN', ids]}).select();
    switch (Number(this.para('status'))) {
    case -1:
    for (const v of data) {
    // 权限验证
    const priv = await this.admin_priv('delete', v.category_id);
    if (!priv) {
    const error = this.controller('cmswing/error');
    return error.noAction('您无权进行该操作!');
    }
    }
    break;
    case 1:
    for (const v of data) {
    // 权限验证
    const priv = await this.admin_priv('examine', v.category_id);
    if (!priv) {
    const error = this.controller('cmswing/error');
    return error.noAction('您无权进行该操作!');
    }
    }
    break;
    case 0:
    for (const v of data) {
    // 权限验证
    const priv = await this.admin_priv('disable', v.category_id);
    if (!priv) {
    const error = this.controller('cmswing/error');
    return error.noAction('您无权进行该操作!');
    }
    }
    break;
    }
    
    if (this.para('status') == -1 || this.para('status') == 0) {
    for (const v of data) {
    // 删除
    await this.model('cmswing/search').delsearch(v.model_id, v.id);
    if (!think.isEmpty(v.keyname) || v.keyname != 0) {
    await this.model('cmswing/keyword').delkey(v.id, v.model_id);
    }
    }
    } else if (this.para('status') == 1) {
    for (const v of data) {
    // 添加到搜索
    await this.model('cmswing/search').addsearch(v.model_id, v.id, v);
    console.log(v.keyname);
    if (!think.isEmpty(v.keyname) || v.keyname != 0) {
    await this.model('cmswing/keyword').addkey(v.keyname, v.id, v.uid, v.model_id, 0);
    }
    }
    }
    await super.setstatusAction('document');
    }

    这是源代码

    yield super.setstatusAction('document');
                ^^^^^
    
    SyntaxError: 'super' keyword unexpected here
        at new Script (vm.js:74:7)
        at createScript (vm.js:246:10)
        at Object.runInThisContext (vm.js:298:10)
        at Module._compile (internal/modules/cjs/loader.js:670:28)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
        at Module.load (internal/modules/cjs/loader.js:612:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
        at Function.Module._load (internal/modules/cjs/loader.js:543:3)
        at Module.require (internal/modules/cjs/loader.js:650:17)
        at require (internal/modules/cjs/helpers.js:20:18)
        at exports.interopRequire (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/loader/util.js:14:13)
        at files.forEach.file (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/loader/common.js:16:26)
        at Array.forEach (<anonymous>)
        at Object.loadFiles (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/loader/common.js:12:11)
        at Object.load (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/loader/common.js:64:32)
        at Loader.loadController (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/index.js:49:19)
        at thinkLoader.loadData (/Users/lcz/WebstormProjects/CmsWing/node_modules/thinkjs/lib/loader.js:45:42)
        at thinkLoader.loadAll (/Users/lcz/WebstormProjects/CmsWing/node_modules/thinkjs/lib/loader.js:110:12)
        at Application.run (/Users/lcz/WebstormProjects/CmsWing/node_modules/thinkjs/lib/application.js:205:18)
        at Object.<anonymous> (/Users/lcz/WebstormProjects/CmsWing/development.js:15:10)
        at Module._compile (internal/modules/cjs/loader.js:699:14)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
        at Module.load (internal/modules/cjs/loader.js:612:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
        at Function.Module._load (internal/modules/cjs/loader.js:543:3)
        at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
        at startup (internal/bootstrap/node.js:238:19)
        at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)

    这是报错

    还是不行

要回复问题请先 登录注册

发起人

静♥♡置じ☆ve快 乐빠 사

要么庸俗,要么孤独
1 month ago
你好! 你还没有登录,请先登录. 登录CmsWing内容管理框架

6 个月前

最近活动

456

浏览次数

关注者: 1 人

网站导航