随笔分类 - vue
摘要:安装 cnpm install axios 使用 import axios from 'axios' axios({ method: 'get', url: 'http://123.207.32.32:8000/home/multidata' }).then(res => { console.log
阅读全文
摘要:不同于mutations,actions可以处理异步操作 index.js import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({ state: { name: 'furon
阅读全文
摘要:<p>square: {{$store.getters.squareCount}}</p> index.js import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({ stat
阅读全文
摘要:index.js import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({ state: { count: 100 }, mutations: { countAdd(state
阅读全文
摘要:下载源码编译 谷歌浏览器加载 使用
阅读全文
摘要:index.js import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({ state: { count: 100 }, mutations: { }, actions: {
阅读全文
摘要:所有执行完成后,回调 Promise.all([ new Promise(resolve => { setTimeout(() => { console.log('furong'); resolve({ name: 'furong', age: 12 }); }, 2000) }), new Pro
阅读全文
摘要:new Promise((resolve) => { var a = 1; resolve(a); }).then((data) => { console.log(data); return data + 1; }).then((data) => { console.log(data); })
阅读全文
摘要:resolve new Promise((resolve, reject) => { setTimeout(() => { console.log('one'); }, 2000) resolve("resolve"); }).then((data) => { console.log(data);
阅读全文
摘要:resolve: { extensions: ['.js', '.vue', '.json'], alias: { 'vue$': 'vue/dist/vue.esm.js', '@': resolve('src'), } }, 使用 import HelloWorld from '@/compon
阅读全文
摘要:匹配的组件会被缓存 <template> <div id="app"> <img src="./assets/logo.png"> <router-link to="/Quange">Quange</router-link> <router-link to="/Furong">Furong</rou
阅读全文
摘要:被包含的组件保留状态,避免重新渲染 Furong.vue <template> <div id="Furong"> <p>{{msg}}</p> <p>{{userInfo}}</p> </div> </template> <script> export default { name: 'Furon
阅读全文
摘要:main.js // The Vue build version to load with the `import` command // (runtime-only or standalone) has been set in webpack.base.conf with an alias. im
阅读全文
摘要:Quange.vue <template> <div id="Quange"> <p>{{msg}}</p> <button type="button" @click="onClick">跳转</button> </div> </template> <script> export default {
阅读全文
摘要:App.vue <template> <div id="app"> <img src="./assets/logo.png"> <router-link to="/Quange/" tag="button">Quange</router-link> <router-link :to="args">F
阅读全文
摘要:export default new Router({ routes: [{ path: '/', name: 'HelloWorld', component: HelloWorld, children: [{ path: '/Furong/:id', name: 'Furong', compone
阅读全文
摘要:// import Furong from '@/components/Furong' // import Quange from '@/components/Quange' const Quange = () => import('@/components/Quange') const Furon
阅读全文
摘要:动态id index.js export default new Router({ routes: [{ path: '/Furong/:id', name: 'Furong', component: Furong }, }) App.vue <template> <div id="app"> <i
阅读全文
摘要:Quange.vue <template> <div id="Quange"> <p>{{msg}}</p> <button type="button" @click="onClick">跳转</button> </div> </template> <script> export default {
阅读全文
摘要:<!-- 渲染成button --> <router-link to="/Quange" tag="button">Quange</router-link> <!-- 取消返回效果 --> <router-link to="/Furong" replace="">Furong</router-lin
阅读全文