index.js
router.get('/', (req, res) => {
var cart = req.cookies.cart;
res.sendFile(path.join(__dirname,'../../src/components/cart.html'),cart);
})
cart.html
<body>
<div id="app" class="container mt-3">
<h2> cart View </h2>
</div>
</body>
<script>
new Vue({
el: '#app',
data: {
}
})
</script>
I want to get cookies in vue..
How to get 'cart' data in Vue ?
Is that right way make res.send('../cart.html',cart)
?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.