0
我想用蒙戈DB 创建WS使用的NodeJS 保存页面内的MongoDB当我点击Save按钮保存代码VUE JS在HTML里面保存VUE js代码里面格在数据库代码保存VUE JS MongoDB中
save(){
var vm=this;
var page={
"id":"2",
"page":vm.$el.innerHTML
}
console.log("hh"+vm.$el.innerHTML);
var HTTPpOST=axios.create({
baseURL: `http://localhost:3000/api/product/2`,
headers: {
Accept:'application/json'
}
})
HTTPpOST.put('',page).then(function(response){
}) .catch(function(error){
var vm=this;
console.log("error"+error);
})
我只能得到没有vue js代码的html代码 我怎样才能将两者都保存在我的数据库中? 这是HTML:
<div id="app" ref="foo">
<ul>
<li v-for="prod in products">
<h1 style="color:red">{{prod.fields.name}}</h1>
<p>{{prod.fields.description}}</p>
</li>
</ul>
<button @click="save">save</button>
</div>