我有一个简单的任务,但我对此有一些麻烦
Mb任何人都知道另一种方法如何使用Carbon获得一年中的所有月份
在这个问题中,我只需要月份的简称
此时我有下一个代码
$items = [];
$startMonth = Carbon::now()->startOfYear()->format('M');
$endMonth = Carbon::now()->endOfYear()->format('M');
$monthRange = CarbonPeriod::create($startMonth, '1 month', $endMonth);
foreach ($monthRange as $month){
$items[] = Carbon::parse($month)->format('M');
}
Run Code Online (Sandbox Code Playgroud)
有没有不覆盖变量 $items 的解决方案
感谢帮助
我不久前开始学习Vue JS
\n我在解决某些问题时遇到一些问题
\n在这种情况下,我需要创建一个事件来隐藏和显示特定对象中的长文本
\n我的应用逻辑如下
\n我正在向服务器发送请求
\n我得到答案
\n然后我将其写入 Vuex 存储
\n并在组件中使用 getter 和循环进行输出
\n如果有人遇到类似的情况,我将不胜感激。
\n这是我的代码的一部分
\nimport {mapActions, mapGetters} from "vuex";\n\n\n<v-list three-line v-for="(comment, index) in product.comments.data" :key="comment.id" class="mb-3">\n\n <v-list-item>\n <p v-if="!readMoreActivated">{{comment.description.slice(0, 200)}}<v-btn @click="activateReadMore(index, comment.description)" x-small text color="grey">\xd0\x9e\xd1\x82\xd0\xba\xd1\x80\xd1\x8b\xd1\x82\xd1\x8c</v-btn></p>\n <p v-if="readMoreActivated">{{comment.description}}</p>\n </v-list-item>\n</v-list>\n\n\n\ncomputed: {\n ...mapGetters("products", ["product"])\n\n },\n\nmethods: {\n activateReadMore(lineId, comment)\n {\n comment.findIndex((lineId) => {\n return comment.slice(1, comment.length)\n })\n // this.readMoreActivated = true\n },\n },\n
Run Code Online (Sandbox Code Playgroud)\n