定制 glitchr/ux-google 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

glitchr/ux-google

Composer 安装命令:

composer require glitchr/ux-google

包简介

Google API integration for Symfony

README 文档

README

Google Maps integration with html2canvas support for Symfony applications.

Requirements

  • jQuery 3.0+ must be loaded globally before this bundle's scripts
  • Symfony Webpack Encore for asset compilation

Installation

  1. Install dependencies:

    npm install
    
  2. Build assets:

    make assets APP_DEBUG=0
    # or
    npm run prod
    

jQuery Configuration

Important: This package expects jQuery to be available globally as window.jQuery and window.$.

In your main application

Make sure your webpack.config.js treats jQuery as an external dependency:

Encore
    .addExternals({
        jquery: 'jQuery'
    })

And load jQuery from CDN in your base template before loading this bundle's scripts:

<script src="https://code.jquery.com/jquery-3.6.2.min.js"></script>
<script src="/bundles/google/maps.js"></script>

Usage

In Twig templates:

{{ google_maps("myMap", {
    "html2canvas": true,
    "style": "height:400px; width:100%;"
}) }}

Export/Suppress buttons:

{{ google_maps_export("myMap", {
    "text": "Export"
}) }}

{{ google_maps_suppress("myMap", {
    "text": "×"
}) }}

jQuery Plugin API

The bundle provides a jQuery plugin for html2canvas:

$('#myMap').html2canvas('#myMap', {
    insert: 'prepend'
}, function(canvas) {
    // Callback when canvas is ready
    console.log('Canvas generated:', canvas);
});

Troubleshooting

$.fn.html2canvas is not a function

This error means jQuery was not loaded before maps.js, or jQuery is being replaced after maps.js loads.

Solution:

  1. Ensure jQuery is loaded from CDN in your base template
  2. Configure Webpack to use external jQuery (see "jQuery Configuration" above)
  3. Don't import jQuery in your bootstrap.js or other entry files

License

LGPL-3.0-or-later

统计信息

  • 总下载量: 180
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2022-11-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固