zoukankan      html  css  js  c++  java
  • Vue 命令

    1、脚手架Cil搭建

    全局安装 npm: npm install -g vue-cli

    创建项目:vue init webpack vueapp(项目名称)

    下载路由模块: npm install vue-router --save  (vue-router为路由名称)

    安装http : npm install vue-resource --save

    安装json-server:npm install -g json-server

    https://github.com/typicode/json-server(json-server   官网)

    2.http请求

    export default {
            name: "customers",
            data() {
                return {
                    customers: []
                }
            },
            methods: {
                fetchCustomers() {
                    this.$http.get("http://localhost:3000/users")
                        .then(function (response){
                            this.customers = response.body
                        })
                }
            },
            created() {
                this.fetchCustomers()
            }
        }

     3、钩子函数

    beforeCreate: function() {
        alert("组件实例化之前执行的函数");
    },
    created: function() {
        alert("组件实例化之完毕但页面还未显示");
    },
    beforeMount: function() {
        alert("组件挂在前,页面扔未展示,但虚拟DOM已经配置");
    },
    mounted: function() {
        alert("组件挂在后,此方法执行后,页面显示");
    },
    beforeUpdate: function() {
        alert("组件更新前,页面扔未更新,但虚拟DOM已经配置");
    },
    updated: function() {
        alert("组件更新后,此方法执行后,页面显示");
    },
    beforeDestory: function() {
        alert("组件销毁前");
    },
    destory: function() {
        alert("组件销毁");
    }
  • 相关阅读:
    Props属性
    逆卷积:convtranspose2d(fractionally-strided convolutions)
    nn.ReflectionPad2d(镜像填充)
    conv1*1的作用
    如何将jupyter中的.ipynb文件转换成python中的.py文件
    低光图像增强学习
    pytorch 中的variable函数
    BCELoss和BCEWithLogitsLoss
    正则化的理解
    网络压缩方法总结
  • 原文地址:https://www.cnblogs.com/hhj3645/p/9488645.html
Copyright © 2011-2022 走看看