我想獲取我的 vue.js 項目的屏幕截圖。因此我將它用于 html2canvas。我使用以下步驟來應用 html2canvas。第 1 步-:將“html2canvas”安裝到我的項目中npm install html2canvas步驟2-:在我的項目代碼中導入html2 canvas。項目代碼-:<template> <div class="hello"> <div id="photo"> <p>This is vue screenshor</p> </div> <button v-on:click="screenshot">Take Picture</button> </div></template><script>//import html2canvas from 'vue-html2canvas';import html2canvas from 'html2canvas';export default { name: 'HelloWorld', data () { return { msg: 'Welcome to Your Vue.js App' } }, methods:{ screenshot(){ console.log('Function Screenshot'); html2canvas(document.getElementById('photo')).then(canvas => { document.body.appendChild(canvas) }); } }}</script>但我正在運行這個項目,它給出以下錯誤 -:ReferenceError: html2canvas is not defined我如何解決這個問題?
將 Canvas 應用到我的 Vue.js 項目時出錯
阿波羅的戰車
2023-07-20 17:39:01