We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>cnode·Supported by Vue</title> </head> <body> <% var postId = _id %> <h1>_id : <%= _id %></h1> <p>postId : <%= postId %></p> <div id="app"> <h1>{{ detailData.content }}</h1> <p>{{ post_id }}</p> </div> </body> <script src="https://unpkg.com/vue"></script> <script src="https://unpkg.com/axios/dist/axios.min.js"></script> <script type="text/javascript"> var postId = '12345654321'; var app = new Vue({ el: "#app", data: { detailData : { content:'zjutszl' }, post_id:postId } }) </script> </html>
var express = require('express'); var router = express.Router(); /* GET users listing. */ router.get('/', function (req, res, next) { res.render('post_detail', {_id:req.query.id}); }); module.exports = router;
为了阅读方便,先放了代码,图片在后面。
The text was updated successfully, but these errors were encountered:
那么问题来了,怎么在Vue里用到routes/post.js传入的数据:_id 呢?
Sorry, something went wrong.
参考 18-edit-post
No branches or pull requests
view/post.ejs
routes/post.js
页面显示
添加一行定义 [var postId = '12345654321']
修改后页面显示
为了阅读方便,先放了代码,图片在后面。
The text was updated successfully, but these errors were encountered: