我有一个vue应用程序,可在所有与webpack捆绑在一起的浏览器中使用,但是对于Internet Explorer,我会尽可能地手动编码该应用程序。
我在浏览器控制台中看到以下错误。
vue.js?ver=5.1.1:634 [Vue warn]: Error in render: "TypeError: Cannot read
property 'groupBy' of undefined"
我已经尝试添加lodash库,但没有帮助。
var locationsByCity = _.groupBy(locations, function(location) {
return location.location_data['prefix-tc_map_city'];
});
脚本按以下顺序添加到</body>
之前。
wp_enqueue_script( 'vue', 'https://cdn.jsdelivr.net/npm/vue/dist/vue.js' ); // Vue
wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?key=XXXX' ); // Google Maps
wp_enqueue_script( 'es6-polyfill', 'https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.min.js' ); // ES6 Polyfill | Promise fixer for ie 11
wp_enqueue_script( 'es6-polyfill-auto', 'https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js' ); // ES6 Polyfill | Promise fixer for ie 11
wp_enqueue_script( 'axios', 'https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js' ); // Axios
wp_enqueue_script( 'lodash', 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js' ); // Lodash
// Local Libs
wp_enqueue_script( 'vue-collapse', plugin_dir_url( dirname( __FILE__ ) ) . 'ie/js/vue2-collapse.js' ); // Vue Collapse
wp_enqueue_script( 'vue-geolocation', plugin_dir_url( dirname( __FILE__ ) ) . 'ie/js/vue-geolocation.js' ); // Vue Browser Geolocation
wp_enqueue_script( 'he-js', plugin_dir_url( dirname( __FILE__ ) ) . 'ie/js/he.js' ); // He.js
wp_enqueue_script( 'geolib-js', plugin_dir_url( dirname( __FILE__ ) ) . 'ie/js/geolib.js' ); // Geolib.js
// Init
wp_enqueue_script( 'init-js', plugin_dir_url( dirname( __FILE__ ) ) . 'ie/js/init.js' ); // init.js
我希望输出平稳运行,并且_.groupBy不应显示未定义。