如果Laravel星火,有一个与下面的联模板`billlable`在Laravel Spark的`update-payment-method-stripe`组件中来自哪里?
<spark-update-payment-method-stripe :user="user" :team="team" :billable-type="billableType" inline-template>
/* ... */
<div class="pull-right">
<span v-if="billable.card_last_four">
<i :class="['fa', 'fa-btn', cardIcon]"></i>
************@{{ billable.card_last_four }}
</span>
</div>
/* ... */
</spark-update-payment-method-stripe>
该模板包括变量billable.card_last_four
一个VUE组件。
如果我追查该组件的定义文件,我看到这个
#File: resources/assets/js/spark-components/settings/payment-method/update-payment-method-stripe.js
var base = require('settings/payment-method/update-payment-method-stripe');
Vue.component('spark-update-payment-method-stripe', {
mixins: [base]
});
,如果我追查基础组件,我看到一个VUE组件定义
#File: spark/resources/assets/js/settings/payment-method/update-payment-method-stripe.js
module.exports = {
props: ['user', 'team', 'billableType'],
/* ... */
然而,没有这些组件似乎在任何地方都定义了billable
。我看到很多对this.billable
的引用。
#File: spark/resources/assets/js/settings/payment-method/update-payment-method-stripe.js
/* ... */
this.form.address = this.billable.billing_address;
this.form.address_line_2 = this.billable.billing_address_line_2;
this.form.city = this.billable.billing_city;
this.form.state = this.billable.billing_state;
this.form.zip = this.billable.billing_zip;
this.form.country = this.billable.billing_country || 'US';
/* ... */
placeholder() {
if (this.billable.card_last_four) {
return `************${this.billable.card_last_four}`;
}
return '';
}
/* ... */
billable
这个属性来自哪里?我假设Vue采用某种形式的元编程和/或魔术来填充这个,但我对Vue不太了解,不知道发生了什么。
这是在github某处吗? – thanksd
@thanksd是和否。Laravel Spark是支付客户的私人存储库 –
可能是某个地方定义的插件。可以搜索Vue.use – Bert