1.使用 mongoose 動態倒入數據html
mongoimport -d student -c areas areas.dat vue
-d 後面是數據庫名稱; -c後面是表名稱 最後是數據源ios
2.使用vue的watch監聽的時候,是能夠有參數的:數據庫
watch:{ pvalue:async function(value){ console.log(value); } }
參數value指的是 pvalue的值。再如,下面的代碼參數val表示的是firstName和lastNameaxios
var vm = new Vue({ el: '#demo', data: { firstName: 'Foo', lastName: 'Bar', fullName: 'Foo Bar' }, watch: { firstName: function (val) { this.fullName = val + ' ' + this.lastName }, lastName: function (val) { this.fullName = this.firstName + ' ' + val } } })
3. 使用組件的名字,不能和默認的元素名稱同樣,例以下面的組件佔用了html的元素名稱:async
<template> <div><select/></div> </template> <script> import Select from '@/components/changeCity/isselect.vue' export default { layout:'blank', components: { Select } } </script>
這樣組件是沒法顯示。mongoose
4. layout,若是page頁面中不定義,則會使用默認的模板。見上圖的layout。this
5.將從接口獲得的數據複製給state,能夠使用下面的方法:spa
getCity:async function(){ let self = this; let {status,data:{city}} = await self.$axios.get(`/geo/getCity`) if(status == 200){ self.city = city.map(item => { return { value:item.id, label:item.name } }) } }
即便用的map方法複製。code