wxml-to-canvas的wxss样式怎么动态加载数据呀?
发布于 4 年前 作者 ligao 13295 次浏览 来自 官方Issues

参考这个帖子https://www.cnblogs.com/Hhhighway/p/13929152.html?ivk_sa=1024320u#_label2写了写,但一直报错

wxml的部分倒是没问题了,不知道style部分怎么动态加载数据

const style =(width, height)=> {
  return `
  {
    "container": {
      "width":`+width+`,
      "height":`+height+`,
      "flexDirection":"column",
      "justifyContent": "space-around",
      "alignItems": "center"
    },
    "text": {
      "width":`+width+`,
      "height":37,
      "fontSize":20,
      "marginTop":10
    }
  `
}

const secondStyle = JSON.parse(style(370, 600)) 
1 回复

虽然还是不明白如何在导入的js文件中动态加载数据,但我在页面的js中成功实现了

回到顶部