Vue custom instruction binds a function, how to pass parameters to the function?

< template >
< div vmurf = "item in [1 record2, 3, 4]" >

<div v-mydirect="fn(item)"></div>

< / div >
< / template >

< script >
import Vue from "vue";

Vue.directive("loadmore", {
    bind (el, binding) {
        binding.value()
    }
})

export default {
    methods: {
        fn (n) {
            console.log(n)
        }
    
    }

}

< / script >

this method can execute a function with no arguments.
I want to execute the fn function when I execute the custom instruction, and then the function gets the item
solution from the loop through the parameters. Thank you!

Dec.13,2021

it should be written this way

<div v-mydirect:fn="item"></div>
Vue.directive('mydirect', {
    bind (el, binding,vnode) {
        let that = vnode.context
        that[binding.arg](binding.value)
    }
})

you can change fn to the form of higher-order functions

fn(i){
    return ()=>{
        console.log(i)
    }
  }

if you just want to get item, directly vmurmyDirect= "item" .

The fn in

vmurmydirection = "fn (item)" should be methods or computed

within the component.
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-1b3e76a-2c42b.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-1b3e76a-2c42b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?