我正在进行会话 API 调用main.js,并使用响应中的值作为根存储的初始值。在 vuex 中它的处理方式如下:
DataService.getSession()
.then((sessionData) => {
new Vue({
i18n,
router,
// this params sessionData.session will be passed to my root store
store: store(sessionData.session),
render: (h) => h(App),
}).$mount('#app');
})
Run Code Online (Sandbox Code Playgroud)
消耗像,
export default function store(sessionData) { // here I'm getting the sessionData
return new Vuex.Store({
strict: process.env.NODE_ENV !== 'production',
state: {
// some states here
},
});
}
Run Code Online (Sandbox Code Playgroud)
对于 Pinia,我们正在创建一个应用程序实例并使其使用如下:
app.use(createPinia())
我的商店会是这样的,
// how to get that sessionData here
import { defineStore } from 'pinia'
export …Run Code Online (Sandbox Code Playgroud) 我遇到过两个C才能问题.
main()
{
int x=4,y,z;
y=--x;
z=x--;
printf("\n%d %d %d",x,y,z);
}
Run Code Online (Sandbox Code Playgroud)
为什么会这样?我在Stack Overflow上看到了很多与此类似的答案.人们回答这是未定义的行为,但如果在采访中提出这个问题,应该如何回答这些问题?