We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// https://cn.vuejs.org/v2/guide/custom-directive.html#%E9%92%A9%E5%AD%90%E5%87%BD%E6%95%B0 // 注册一个全局自定义指令 'v-focus' export default { // 当被绑定的元素插入到 DOM 中时…… inserted: function (el) { // 聚焦元素 el.focus() } }
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
// chart/WaterMark.js export default class WaterMark { constructor (userNm, userCd) { this.userNm = userNm this.userCd = userCd } draw () { let canvas = document.createElement('canvas') let ctx = canvas.getContext('2d') canvas.width = 250 canvas.height = 130 ctx.translate(canvas.width / 2, canvas.height / 2 - 35) ctx.rotate(-Math.PI / 12) ctx.font = '700 12px/Mircosoft Yahei' ctx.textAlign = 'center' ctx.textBaseline = 'middle' ctx.fillStyle = '#eaf0f5' // ctx.fillStyle = '#f00' ctx.fillText(`镜心的小树屋 ${this.userNm} ${this.userCd}`, 0, 0) return canvas.toDataURL('image/png') } }
// directives/WaterMark.js import WaterMark from '../chart/WaterMark.js' import { useInfor } from '../rule' export default { inserted (el, binding) { let timer = setInterval(() => { if (useInfor.data.userNm && useInfor.data.userCd) { let wMark = new WaterMark(useInfor.data.userNm, useInfor.data.userCd) let imageSrc = wMark.draw() if (binding.value && binding.value === false) return el.style.background = `#fff url(${imageSrc}) repeat top left` clearInterval(timer) } }, 50) } }
No branches or pull requests
v-Focus
The text was updated successfully, but these errors were encountered: