![](/img/trans.png)
[英]How can I get data from a get function to another function in the same js file in node.js?
[英]How can I get the data in Vue from Node.js
索引.js
router.get('/', (req, res) => {
var cart = req.cookies.cart;
res.sendFile(path.join(__dirname,'../../src/components/cart.html'),cart);
})
购物车.html
<body>
<div id="app" class="container mt-3">
<h2> cart View </h2>
</div>
</body>
<script>
new Vue({
el: '#app',
data: {
}
})
</script>
我想在 vue 中获取 cookie ..
如何在 Vue 中获取“购物车”数据?
这是正确的方法 make res.send('../cart.html',cart)
吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.