grapesjs实现选择元素生成截图图片效果代码
代码语言:html
所属分类:其他
代码描述:grapesjs实现选择元素生成截图图片效果代码,选择设计区的任意元素,点击截图,就能生成这个元素的截图图片。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>GrapesJS 元素截图示例</title> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/grapesjs-preset-webpage.min.css"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/grapes.min.css"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/grapes.min.js"></script> <!--引入grapesjs-preset-webpage--> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/grapes.min.css"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/grapesjs-preset-webpage.min.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/html2canvas.1.4.1.js"></script> <style> body, html { height: 100%; margin: 0; } .editor-container { height: 100vh; } </style> </head> <body> <div id="gjs" class="editor-container"></div> <script> document.addEventListener('DOMContentLoaded', function() { const editor = grapesjs.init({ container: '#gjs', height: '100%', storageManager: false, plugins: ['gjs-preset-webpage'], pluginsOpts: { 'gjs-preset-webpage': {} } // 其他配置... }); .........完整代码请登录后点击上方下载按钮下载查看
网友评论0