Vue.js Vuejs-当组件位于另一个组件中时,方法是否不起作用?

Vue.js Vuejs-当组件位于另一个组件中时,方法是否不起作用?,vue.js,Vue.js,当组件位于另一个组件的内部时,计算折扣的内部方法将不起作用 productlist(v-slot="{ cellBox, cellType }", view-type="line") productshort(title="lorem ipsum", instock="12", caption="EVR07.3405", price="6500", oldprice="7900", image="img/demo/1.jpg", :cellclass="cellBox", :cardtyp

当组件位于另一个组件的内部时,计算折扣的内部方法将不起作用

productlist(v-slot="{ cellBox, cellType }", view-type="line")
   productshort(title="lorem ipsum", instock="12", caption="EVR07.3405", price="6500", oldprice="7900", image="img/demo/1.jpg", :cellclass="cellBox", :cardtype="cellType")
percentage()
方法计算折扣百分比,但当
productshort
组件位于
productlist
组件内时,
percentage()
方法不执行


div(:class=“cellclass”)
.产品简称(:class=“intclass”)
.product-short\u\u页脚
.产品-短期价格
span.智能徽章(v-if=“oldprice”)–{{finalsell}₽
.填写价格(v-if=“价格”)
b{{price}₽
s(v-if=“oldprice”){{oldprice}₽
导出默认值{
名称:“productshort”,
道具:{
销售百分比:{
类型:编号
},
单元类:{
类型:字符串,
默认值:“”
},
卡片类型:{
类型:字符串,
默认值:“行”
},
国际级:{
类型:字符串
},
价格:{
类型:编号
},
旧价格:{
类型:编号
},
finalsell:{
类型:编号
},
},
方法:{
百分比(){
this.finalsell=parseInt(this.oldprice)-parseInt(this.price);
如果(这是旧价格){
this.sellpercent=parseInt(this.finalsell)/parseInt(this.oldprice)*100;
this.oldprice=parseInt(this.oldprice.toLocaleString('ru-ru'))
}
如果(this.finalsell)this.finalsell=parseInt(this.finalsell.toLocaleString('ru-ru');
如果(this.price)this.price=parseInt(this.price).toLocaleString('ru-ru');
}
},
安装的(){
这个。百分比();
}
}

*方法可以工作,但页面上的可视部分没有更新您是否尝试使用计算属性而不是方法?请参阅:不应更新组件内部的道具。也许这就是问题所在。有任何警告吗?没有,没有警告:(当我单击parrent组件上的任何按钮时,卡是更新的,方法是运行的(如果我使用控制台日志),但页面没有更新您是否尝试了Vue.nextTick?可能与异步DOM呈现有关。