props -> data -> computed -> watch -> created -> mounted -> methods
因此:
如下的productList()函数,内部变量,如果需要使用mounted计算/获取数据,就需要放到method内,不能放到computed。
如果函数在computed内,因为computed在mounted前运行,函数内的变量在计算时,就不是mounted处理后的。
<el-option v-for="item, index in productList()" :key="index" :label="item" :value="item"></el-option>
method使用时,需要加();