How does the vue v-text instruction call the method that has been passed by import

for example, define a tag in template
< div class= "cg_table_row_fundname" > {{getShortTxtWithLength (item.fundname, 6)}} < / div >

The

getShortTxtWithLength method is introduced into the current component in the following ways
import {getShortTxtWithLength} from "src/utils/index.js";

but hint:

clipboard.png

how to use this method correctly?

Mar.02,2021

is it not possible to bind the function getShortTxtWithLength to vue.prototype?


declare this method again in methods, so that:

methods: {
    getShortTxtWithLength,
    // 
}

The

error message tells you that there is no such method under the vue object, so to use vue syntax sugar access, you must first mount the corresponding content to the vue object.

as said on the first floor, mount it into the methods method first so that you can access it through {{}}.

Menu