Implicit Parametric questions in Vuex documents

clipboard.png

clipboard.png

The value 2 passed in during the

call will not be passed into the state parameter? But directly to the id?

how to implicitly pass in state? The expression of learning C is not quite understood. No, no, no.

Mar.03,2021

store.getters.getTodoById

returns the function you defined

function(id) {}

the parameter id is passed to your function in the call


console.log (store.getters.getTodoById) , you can see why the value passed in is id


what you see is not necessarily the same code as what is actually executed. For example:

config = {
    getVal (state, getters) {
        return (params) => {console.log(state, params)}
        // stateparams
    }
}
function init (config) {
    let state = xx
    let getters = xxx
    config.getVal = config.getVal.call(this, state, getters)
    return config
}

now I've shielded the details of the init function and encapsulated it in a library called vuex.
after init processing, you can use config.getVal (params), directly without passing state.

init(config).getVal('')
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9a7ea-17e3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9a7ea-17e3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?