/**
 * 表码翻译指令
 * @Author: huangjq
 * @Date:   2019-04-08
 * @Project jz
 */
import ztData from "@/utils/zt-data";
export default function (el, binding) {
    let params = {};
    let elInnerText = el.textContent.replace(/[ ]|[\r\n]/g, "");
    ["enum", "code", "url"].some((item) => {
        if (binding.value[item]) {
            params = binding.value;
            return true;
        }
    });
    ztData.fetchData(
        params,
        function (data) {
            if (data[elInnerText]) {
                el.textContent = data[elInnerText];
            }
        },
        "codeObj"
    );
}
