• 【Python Web】Flask框架(八)前端基础整合


    前端基础整合

    • HTML
    • CSS
    • JavaScript,jQuery
    • bootstrap(动态效果依赖jQuery)

    先引入bootstrap和jQuery

    DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Titletitle>
        <link rel="stylesheet" href="static/plugins/bootstrap3/css/bootstrap.css">
        <link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
    head>
    <body>
    
    
    
        <script src="static/js/jquery-3.6.1.min.js">script>
        <script src="static/plugins/bootstrap3/js/bootstrap.js">script>
    
    body>
    html>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • JavaScript组件的一些应用
    DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Titletitle>
        <link rel="stylesheet" href="static/plugins/bootstrap3/css/bootstrap.css">
        <link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
    
        <style>
    
            .navbar {
                border-radius: 0px;
            }
    
        style>
    
    head>
    <body>
    <nav class="navbar navbar-inverse">
        <div class="container-fluid">
            
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                        data-target="#bs-example-navbar-collapse-9" aria-expanded="false">
                    <span class="sr-only">Toggle navigationspan>
                    <span class="icon-bar">span>
                    <span class="icon-bar">span>
                    <span class="icon-bar">span>
                button>
                <a class="navbar-brand" href="#">xx系统a>
            div>
    
            
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9">
                <ul class="nav navbar-nav">
                    <li class="active"><a href="#">Homea>li>
                    <li><a href="#">Linka>li>
                    <li><a href="#">Linka>li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                           aria-expanded="false">Dropdown <span class="caret">span>a>
                        <ul class="dropdown-menu">
                            <li><a href="#">Actiona>li>
                            <li><a href="#">Another actiona>li>
                            <li><a href="#">Something else herea>li>
                            <li role="separator" class="divider">li>
                            <li><a href="#">Separated linka>li>
                            <li role="separator" class="divider">li>
                            <li><a href="#">One more separated linka>li>
                        ul>
                    li>
                ul>
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="#">登录a>li>
                    <li><a href="#">注册a>li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                           aria-expanded="false">librafree <span class="caret">span>a>
                        <ul class="dropdown-menu">
                            <li><a href="#">个人资料a>li>
                            <li><a href="#">我的账户a>li>
                            <li><a href="#">修改密码a>li>
                            <li role="separator" class="divider">li>
                            <li><a href="#">注销a>li>
                        ul>
                    li>
                ul>
            div>
        div>
    nav>
    
    
    <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
        Launch demo modal
    button>
    
    
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×span>
                    button>
                    <h4 class="modal-title" id="myModalLabel">Modal titleh4>
                div>
                <div class="modal-body">
                    ...
                div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Closebutton>
                    <button type="button" class="btn btn-primary">Save changesbutton>
                div>
            div>
        div>
    div>
    
    <div class="bs-example-tooltips">
        <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="left" title=""
                data-original-title="Tooltip on left">Tooltip on left
        button>
        <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title=""
                data-original-title="Tooltip on top">Tooltip on top
        button>
        <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title=""
                data-original-title="Tooltip on bottom">Tooltip on bottom
        button>
        <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title=""
                data-original-title="Tooltip on right">Tooltip on right
        button>
    div>
    
    <div>
        <button id="element" type="button" class="btn btn-lg btn-danger" data-toggle="popover" title="标题"
                data-content="And here's some amazing content. It's very engaging. Right?">内容
        button>
    div>
    
    
    <div style="width: 700px">
        <div id="carousel-example-captions" class="carousel slide" data-ride="carousel">
            <ol class="carousel-indicators">
                <li data-target="#carousel-example-captions" data-slide-to="0" class="">li>
                <li data-target="#carousel-example-captions" data-slide-to="1" class="">li>
                <li data-target="#carousel-example-captions" data-slide-to="2" class="active">li>
            ol>
            <div class="carousel-inner" role="listbox">
                <div class="item">
                    <img data-src="holder.js/900x500/auto/#777:#777" alt="900x500"
                         src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iOTAwIiBoZWlnaHQ9IjUwMCIgdmlld0JveD0iMCAwIDkwMCA1MDAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjwhLS0KU291cmNlIFVSTDogaG9sZGVyLmpzLzkwMHg1MDAvYXV0by8jNzc3OiM3NzcKQ3JlYXRlZCB3aXRoIEhvbGRlci5qcyAyLjYuMC4KTGVhcm4gbW9yZSBhdCBodHRwOi8vaG9sZGVyanMuY29tCihjKSAyMDEyLTIwMTUgSXZhbiBNYWxvcGluc2t5IC0gaHR0cDovL2ltc2t5LmNvCi0tPjxkZWZzPjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+PCFbQ0RBVEFbI2hvbGRlcl8xODM0ZmQ2OWFmMiB0ZXh0IHsgZmlsbDojNzc3O2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1mYW1pbHk6QXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7Zm9udC1zaXplOjQ1cHQgfSBdXT48L3N0eWxlPjwvZGVmcz48ZyBpZD0iaG9sZGVyXzE4MzRmZDY5YWYyIj48cmVjdCB3aWR0aD0iOTAwIiBoZWlnaHQ9IjUwMCIgZmlsbD0iIzc3NyIvPjxnPjx0ZXh0IHg9IjMzMy4yMDYyNDU0MjIzNjMzIiB5PSIyNzAuMTYwMDAxMzczMjkxMDQiPjkwMHg1MDA8L3RleHQ+PC9nPjwvZz48L3N2Zz4="
                         data-holder-rendered="true">
                    <div class="carousel-caption">
                        <h3>First slide labelh3>
                        <p>Nulla vitae elit libero, a pharetra augue mollis interdum.p>
                    div>
                div>
                <div class="item">
                    <img data-src="holder.js/900x500/auto/#666:#666" alt="900x500"
                         src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iOTAwIiBoZWlnaHQ9IjUwMCIgdmlld0JveD0iMCAwIDkwMCA1MDAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjwhLS0KU291cmNlIFVSTDogaG9sZGVyLmpzLzkwMHg1MDAvYXV0by8jNjY2OiM2NjYKQ3JlYXRlZCB3aXRoIEhvbGRlci5qcyAyLjYuMC4KTGVhcm4gbW9yZSBhdCBodHRwOi8vaG9sZGVyanMuY29tCihjKSAyMDEyLTIwMTUgSXZhbiBNYWxvcGluc2t5IC0gaHR0cDovL2ltc2t5LmNvCi0tPjxkZWZzPjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+PCFbQ0RBVEFbI2hvbGRlcl8xODM0ZmQ2ODU3YiB0ZXh0IHsgZmlsbDojNjY2O2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1mYW1pbHk6QXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7Zm9udC1zaXplOjQ1cHQgfSBdXT48L3N0eWxlPjwvZGVmcz48ZyBpZD0iaG9sZGVyXzE4MzRmZDY4NTdiIj48cmVjdCB3aWR0aD0iOTAwIiBoZWlnaHQ9IjUwMCIgZmlsbD0iIzY2NiIvPjxnPjx0ZXh0IHg9IjMzMy4yMDYyNDU0MjIzNjMzIiB5PSIyNzAuMTYwMDAxMzczMjkxMDQiPjkwMHg1MDA8L3RleHQ+PC9nPjwvZz48L3N2Zz4="
                         data-holder-rendered="true">
                    <div class="carousel-caption">
                        <h3>Second slide labelh3>
                        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.p>
                    div>
                div>
                <div class="item active">
                    <img data-src="holder.js/900x500/auto/#555:#555" alt="900x500"
                         src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iOTAwIiBoZWlnaHQ9IjUwMCIgdmlld0JveD0iMCAwIDkwMCA1MDAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjwhLS0KU291cmNlIFVSTDogaG9sZGVyLmpzLzkwMHg1MDAvYXV0by8jNTU1OiM1NTUKQ3JlYXRlZCB3aXRoIEhvbGRlci5qcyAyLjYuMC4KTGVhcm4gbW9yZSBhdCBodHRwOi8vaG9sZGVyanMuY29tCihjKSAyMDEyLTIwMTUgSXZhbiBNYWxvcGluc2t5IC0gaHR0cDovL2ltc2t5LmNvCi0tPjxkZWZzPjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+PCFbQ0RBVEFbI2hvbGRlcl8xODM0ZmQ2YzUwYyB0ZXh0IHsgZmlsbDojNTU1O2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1mYW1pbHk6QXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7Zm9udC1zaXplOjQ1cHQgfSBdXT48L3N0eWxlPjwvZGVmcz48ZyBpZD0iaG9sZGVyXzE4MzRmZDZjNTBjIj48cmVjdCB3aWR0aD0iOTAwIiBoZWlnaHQ9IjUwMCIgZmlsbD0iIzU1NSIvPjxnPjx0ZXh0IHg9IjMzMy4yMDYyNDU0MjIzNjMzIiB5PSIyNzAuMTYwMDAxMzczMjkxMDQiPjkwMHg1MDA8L3RleHQ+PC9nPjwvZz48L3N2Zz4="
                         data-holder-rendered="true">
                    <div class="carousel-caption">
                        <h3>Third slide labelh3>
                        <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.p>
                    div>
                div>
            div>
            <a class="left carousel-control" href="#carousel-example-captions" role="button" data-slide="prev">
                <span class="glyphicon glyphicon-chevron-left" aria-hidden="true">span>
                <span class="sr-only">Previousspan>
            a>
            <a class="right carousel-control" href="#carousel-example-captions" role="button" data-slide="next">
                <span class="glyphicon glyphicon-chevron-right" aria-hidden="true">span>
                <span class="sr-only">Nextspan>
            a>
        div>
    div>
    
    
    <script src="static/js/jquery-3.6.1.min.js">script>
    <script src="static/plugins/bootstrap3/js/bootstrap.js">script>
    
    <script>
        $(function () {
            $('[data-toggle="tooltip"]').tooltip()
            $('#element').popover({trigger: "click", placement: "bottom"})
            $('.carousel').carousel()
        })
    script>
    
    body>
    html>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179

    案例:添加数据页面

    人员录入系统,需要提供用户信息:

    • 用户名,年龄,薪资,部门,入职时间
    • 对于时间的选择不能输入(插件) datetimepicker
      • 下载插件
      • 应用插件
      • 也可以设置input为date

    在这里插入图片描述

    
    DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Titletitle>
        <link rel="stylesheet" href="static/plugins/bootstrap3/css/bootstrap.css">
        <link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
    head>
    <body>
    
    <div class="container">
        <form class="form-horizontal">
            <div class="row clearfix">
    
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">姓名label>
                        <div class="col-sm-10">
                            <input type="email" class="form-control" placeholder="姓名">
                        div>
                    div>
                div>
    
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">年龄label>
                        <div class="col-sm-10">
                            <input type="email" class="form-control" placeholder="年龄">
                        div>
                    div>
                div>
            div>
    
    
            <div class="row clearfix">
    
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">薪资label>
                        <div class="col-sm-10">
                            <input type="email" class="form-control" placeholder="薪资">
                        div>
                    div>
                div>
    
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">部门label>
                        <div class="col-sm-10">
                            <select class="form-control">
                                <option>IToption>
                                <option>销售option>
                                <option>运营option>
                            select>
                        div>
                    div>
                div>
            div>
    
            <div class="row clearfix">
    
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">入职日期label>
                        <div class="col-sm-10">
                            <input type="date" class="form-control" placeholder="入职日期">
                        div>
                    div>
                div>
    
    
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-primary">提交button>
                    div>
                div>
                
            div>   
    
        form>
    
    div>
    
    
    <script src="static/js/jquery-3.6.1.min.js">script>
    <script src="static/plugins/bootstrap3/js/bootstrap.js">script>
    
    
    script>
    
    body>
    html>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
  • 相关阅读:
    基于低代码平台的PLM系统,实现科学业务管理
    CIE A-level经济加权分算法
    1447_TC275 DataSheet阅读笔记8_电气特性
    《云计算:云端协同,智慧互联》
    React使用西瓜播放器
    【PMSM】二. 经典电流环、速度环设计(下)
    【微信小程序】传参存储
    我们用STM32开发时为什么要使用架构
    【Windows版本控制】上海道宁为您提供VisualSVN下载、试用、教程
    Django数据删除方法
  • 原文地址:https://blog.csdn.net/qq_51670115/article/details/126919639