Open zj007-yj opened 7 months ago
latest
2.5.4
NPM 依赖
Windows
Chrome
Vue 2
1.我希望有一个自定义函数列表来进行选择功能函数,然后去重构了他,但是不生效
import { getfunction } from '@/api/design'
export default (function() { var function_list = [] getfunction().then(response => { if (response.code === 200) { function_list = response.data.list console.log(response.data.list) console.log(function_list) } else { this.msgError(response.msg) } }) function t() { // json模板 options 对应键值 key this.name = 'formatter' } // 在这里添加你的函数 // function customFontSize(value, options, target, templateData) { // const aa = 17.75 // const maxwidth = options.width // const maxheight = options.height // let fontSize = options.fontSize || aa // const arr = value.split('·') // let num = 0 // // if (value.indexOf('·') !== -1) { // for (let i = 0; i < arr.length; i++) { // num = num > arr[i].length ? num : arr[i].length // } // } else { // num = value.length // } // // const fontHeight = value.split('·').length // // while (fontHeight fontSize > maxheight) { // fontSize = fontSize - 0.5 // } // // while (num fontSize > maxwidth) { // fontSize = fontSize - 0.5 // } // return fontSize // } // function (value,options,target,templateData){ let aa=17.75; let maxwidth = options.width; let maxheight = options.height; let fontSize = aa?aa:options.fontSize; let arr=value.split('·'); let num=0; if (value.indexOf('·')!==-1){ for (let i=0;i<arr.length;i++){ num=num>arr[i].length?num:arr[i].length; } }else { num=value.length+1; } let fontHeight=value.split('·').length; while(fontHeightfontSize>maxheight){ fontSize=fontSize-0.5; } while (numfontSize>maxwidth){ fontSize=fontSize-0.5; } return {'font-size':fontSize+'pt'} } // 涉及修改元素样式, 添加一个 css 方法 // t: 元素对象, e 参数值 return t.prototype.css = function(t, e, i) { return null }, // 创建 DOM t.prototype.createTarget = function() { const list = function_list let fontSizeList = '\n 默认' list.forEach(function(e) { fontSizeList += '\n ' + e.title + '' }) this.target = $('
1.formatter 重构下拉框,设置函数生效
1.formatter 重构下拉框,设置函数不生效
[在这里上传图片]
使用的版本
latest
版本号
2.5.4
你的安装方式
NPM 依赖
你的操作系统
Windows
你的浏览器
Chrome
你的项目编程语言
Vue 2
问题描述
1.我希望有一个自定义函数列表来进行选择功能函数,然后去重构了他,但是不生效
如何复现
import { getfunction } from '@/api/design'
export default (function() { var function_list = [] getfunction().then(response => { if (response.code === 200) { function_list = response.data.list console.log(response.data.list) console.log(function_list) } else { this.msgError(response.msg) } }) function t() { // json模板 options 对应键值 key this.name = 'formatter' } // 在这里添加你的函数 // function customFontSize(value, options, target, templateData) { // const aa = 17.75 // const maxwidth = options.width // const maxheight = options.height // let fontSize = options.fontSize || aa // const arr = value.split('·') // let num = 0 // // if (value.indexOf('·') !== -1) { // for (let i = 0; i < arr.length; i++) { // num = num > arr[i].length ? num : arr[i].length // } // } else { // num = value.length // } // // const fontHeight = value.split('·').length // // while (fontHeight fontSize > maxheight) { // fontSize = fontSize - 0.5 // } // // while (num fontSize > maxwidth) { // fontSize = fontSize - 0.5 // } // return fontSize // } // function (value,options,target,templateData){ let aa=17.75; let maxwidth = options.width; let maxheight = options.height; let fontSize = aa?aa:options.fontSize; let arr=value.split('·'); let num=0; if (value.indexOf('·')!==-1){ for (let i=0;i<arr.length;i++){ num=num>arr[i].length?num:arr[i].length; } }else { num=value.length+1; } let fontHeight=value.split('·').length; while(fontHeightfontSize>maxheight){ fontSize=fontSize-0.5; } while (numfontSize>maxwidth){ fontSize=fontSize-0.5; } return {'font-size':fontSize+'pt'} } // 涉及修改元素样式, 添加一个 css 方法 // t: 元素对象, e 参数值 return t.prototype.css = function(t, e, i) { return null }, // 创建 DOM t.prototype.createTarget = function() { const list = function_list let fontSizeList = '\n ' list.forEach(function(e) { fontSizeList += '\n ' }) this.target = $('
预期结果
1.formatter 重构下拉框,设置函数生效
实际结果
1.formatter 重构下拉框,设置函数不生效
截图或视频
[在这里上传图片]
这个问题是否已经存在?