小编App*_*Pie的帖子

如何使 axios 调用同步?

我遇到了 get_user() 在 console.log(usersOutput, 'here') 之后运行的问题。如何更改它以便 get_user() 首先运行?

function get_user(user){
        axios.get(`/api/admin/users`,{params:{idnum:user}}).then((user)=>{
           console.log('got user')
           return user.data
        })
}

var UsersFormatter = function(c){
    let usersOutput = 'waiting for change'
    var usersOutput = get_user(c.cell.row.data.sessionUser)
    console.log(usersOutput,' here')
    return usersOutput
}
Run Code Online (Sandbox Code Playgroud)

javascript node.js

13
推荐指数
2
解决办法
5万
查看次数

在 mod_wsgi 中运行时导入 numpy 显示警告

我正在 Apache 中使用 mod_wsgi 运行 Flask 应用程序。当我尝试导入 numpy 时,收到以下警告:

/usr/local/lib/python3.8/dist-packages/scipy/__init__.py:67:UserWarning:NumPy 是从 Python 子解释器导入的,但 NumPy 无法正确支持子解释器。这可能适用于大多数用户,但可能会导致难以追踪问题或细微的错误。罕见的子解释器功能的一个常见用户是 wsgi,它也允许单解释器模式。欢迎针对错误进行改进,但这不在 NumPy 路线图上,并且可能需要付出巨大的努力才能实现全面支持。

我应该采取什么措施来解决这个警告吗?

python mod-wsgi numpy

11
推荐指数
1
解决办法
4054
查看次数

如何使用 v-on:change 将输入文本传递给我的 vue 方法?

如何将输入值从我的 html 传递给我的名为 checkEx ist() 的 vue 方法?我想在我的 checkExist() 方法中检索该值。任何建议我怎么能做到这一点?我还是 vue 新手。

HTML:

<input type="text" class="form-control" placeholder="Email*" v-model="form.email" v-validate="'required|email'"  v-on:change="checkExist">
Run Code Online (Sandbox Code Playgroud)

元素:

Vue.component('button-counter', {
  data: function () {
    return {
      count: 0
    }
  },
  methods: {
       checkExist:function(){
       }
  }
})
Run Code Online (Sandbox Code Playgroud)

html javascript ecmascript-6 vue.js

7
推荐指数
2
解决办法
2万
查看次数

UnhandledPromiseRejectionWarning:MongoNetworkError:首次连接时无法连接到服务器[localhost:27017] [MongoNetworkError

我试图运行以下命令:

node index.js
Run Code Online (Sandbox Code Playgroud)

但是,我从终端获得以下内容:

    success connection to port 3000
(node:16767) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError
: connect ECONNREFUSED 127.0.0.1:27017]
    at Pool.<anonymous> (/Users/hatchery/Documents/nodejs/fxexpress/node_modules/mongoose/node_modules/mongodb-core/lib/topologies/server.js:503:11
)
    at emitOne (events.js:116:13)
    at Pool.emit (events.js:211:7)
    at Connection.<anonymous> (/Users/hatchery/Documents/nodejs/fxexpress/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:326:12)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at Connection.emit (events.js:214:7)
    at Socket.<anonymous> (/Users/hatchery/Documents/nodejs/fxexpress/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:245:50)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
(node:16767) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing …
Run Code Online (Sandbox Code Playgroud)

javascript mongodb node.js express handlebars.js

2
推荐指数
3
解决办法
1万
查看次数