【发布时间】:2020-04-18 19:30:06
【问题描述】:
所以我想构建 pug mixin:
mixin productTile({img, title, desc, price, withCatLink = false, cat: {title = '', path = ''} = {}})
.ProductTile
p
+icon({name: 'long-arrow-right'})
我这样称呼它:
-
const prodInfo = {
img: '/img/icon.png',
title: 'test title',
desc: 'testdesc',
price: '1200',
withCatLink: true,
cat: {
title: 'test category',
path: ''
}
};
+productTile(prodInfo)
但我正面临着这个问题:
SyntaxError: Argument name clash (366:103)
所以也许我对对象道具解构有误,因为当我从 mixin 声明中删除 cat: {title = '', path = ''} = {} 时,一切正常
【问题讨论】:
标签: javascript pug mixins