wxml-transformer icon indicating copy to clipboard operation
wxml-transformer copied to clipboard

wxml标签内无属性时报错TypeError: Cannot convert undefined or null to object

Open songyazhao opened this issue 6 years ago • 1 comments

[email protected] [email protected]

复现步骤:

const wt = require('wxml-transformer')
wt.toHtml(`<view id="con">{{ 123 }}</view>`) // 没问题
wt.toHtml(`<view>{{ 123 }}</view>`) // 报下面的错
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at elementToObject (D:\GitHubOther\Plz-shop\node_modules\wxml-transformer\dist\index.js:137:16)
    at D:\GitHubOther\Plz-shop\node_modules\wxml-transformer\dist\index.js:174:21
    at each (D:\GitHubOther\Plz-shop\node_modules\wxml-transformer\dist\index.js:12:13)
    at toObject (D:\GitHubOther\Plz-shop\node_modules\wxml-transformer\dist\index.js:173:5)
    at Object.toHtml (D:\GitHubOther\Plz-shop\node_modules\wxml-transformer\dist\index.js:274:22)

songyazhao avatar Jun 23 '18 08:06 songyazhao