Javascript 带有静态vue的Django gettext函数

Javascript 带有静态vue的Django gettext函数,javascript,django,vue.js,Javascript,Django,Vue.js,我有两个单独的文件 .html(Django) vue先生 然后一起使用 **.html** <div id="container" is="edit-contact-info" > <div slot="csrf-token">{% csrf_token %}</div> </div> <script src="{% static_with_version '/j

我有两个单独的文件

  • .html(Django)
  • vue先生
  • 然后一起使用

    **.html**
    
    <div
    id="container"
    is="edit-contact-info"
    >
      <div slot="csrf-token">{% csrf_token %}</div>
    </div>
    
    <script src="{% static_with_version '/js/restaurant/edit_contact_info.js' %}"></script>
    
    <script type="text/javascript" src="{% url 'test.jsi18n' %}"></script>
    <script>
      var test = gettext
      console.log(test('Country'), "!!!!!!!!!!!!");
    </script>
    **.html**
    
    **.vue**
    beforeCreate() {
        console.log("hi");
        console.log(window);
        console.log(window.django.gettext('Country'));
      }
    **.vue**
    
    **.html**
    {%csrf_令牌%}
    var test=gettext
    console.log(测试('Country'),“!!!!!!!!!”;
    **.html**
    **vue先生**
    beforeCreate(){
    控制台日志(“hi”);
    控制台日志(窗口);
    log(window.django.gettext('Country');
    }
    **vue先生**
    
    我想知道如何访问vue文件中的函数gettext。目前它在window.django时没有定义,但如果我记录console.log(window),它表明django已经在window对象中了

    谢谢你的帮助