HTML中使用CDN引入形式进行Vue.js+Axios+Echarts+Element+AntDesignVue开发

引言

不是所有的前端项目都适合使用node.js开发,有时候我们只是进行一些简单页面的开发。比如每次开发java web,thymeleaf和freemarker写的很难受,不如vue.js开发来的迅速,而且对于一个有前后端分离开发习惯的人来说,几乎可以无学习成本直接上手。特别在一些公司的老项目中,往往只能使用最原始的jsp形式开发,这是如果在jsp中使用vue.js的形式开发前端,往往事半功倍,还可以避免学习淘汰技术,顺便学习vue.js。

环境搭建

使用CDN形式引入vue.js axios echarts element ui ant design vue

如果是本地开发,可以将CDN指向的资源文件下载到本地进行引入

vue.js 2

<html>

<head>
    <title>Title</title>
    <!-- vue.js 2.7.14 -->
    <script src="https://unpkg.com/[email protected]/dist/vue.min.js"></script>
    <!-- element 2.15.12 -->
    <link rel="stylesheet" href="https://unpkg.com/[email protected]/lib/theme-chalk/index.css" />
    <script src="https://unpkg.com/[email protected]/lib/index.js"></script>
    <!-- ant design vue 1.7.8 -->
    <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/antd.min.css" />
    <script src="https://unpkg.com/[email protected]/dist/antd.min.js"></script>
    <!-- axios 1.1.2 -->
    <script src="https://unpkg.com/[email protected]/dist/axios.min.js"></script>
    <!-- echarts 5.4.1 -->
    <script src="https://unpkg.com/[email protected]/dist/echarts.min.js"></script>
</head>

<body>
    <div id="app">

    </div>
</body>
<script>
    new Vue({
      
      
        el: '#app',
        data() {
      
      
            return {
      
      

            }
        },
        mounted() {
      
       },
        methods: {
      
      }
    })
</script>
<style>
</style>

</html>

vue.js 3

<html>

<head>
    <title>Title</title>
    <!-- vue.js 3.2.45 -->
    <script src="https://unpkg.com/[email protected]/dist/vue.global.prod.js"></script>
    <!-- element plus 2.2.28 -->
    <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/index.css" />
    <script src="https://unpkg.com/@element-plus/icons-vue"></script>
    <script src="https://unpkg.com/[email protected]"></script>
    <!-- ant design vue 3.2.15 -->
    <script src="https://unpkg.com/dayjs/dayjs.min.js"></script>
    <script src="https://unpkg.com/dayjs/plugin/customParseFormat.js"></script>
    <script src="https://unpkg.com/dayjs/plugin/weekday.js"></script>
    <script src="https://unpkg.com/dayjs/plugin/localeData.js"></script>
    <script src="https://unpkg.com/dayjs/plugin/weekOfYear.js"></script>
    <script src="https://unpkg.com/dayjs/plugin/weekYear.js"></script>
    <script src="https://unpkg.com/dayjs/plugin/advancedFormat.js"></script>
    <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/antd.min.css" />
    <script src="https://unpkg.com/[email protected]/dist/antd.min.js"></script>
    <!-- axios 1.1.2 -->
    <script src="https://unpkg.com/[email protected]/dist/axios.min.js"></script>
    <!-- echarts 5.4.1 -->
    <script src="https://unpkg.com/[email protected]/dist/echarts.min.js"></script>
</head>

<body>
    <div id="app">

    </div>
</body>
<script>
    const App = {
      
      
        setup() {
      
      
            return {
      
      
            }
        },
        mounted() {
      
       },
        methods: {
      
      }
    }
    const {
      
       createApp, ref, reactive } = Vue
    createApp(App).use(ElementPlus).use(antd).mount('#app')
</script>
<style>
</style>

</html>

CSS样式

/* 横向弹性布局 */
flex: 1;
display: flex;
flex-flow: row wrap;
/*去除内边距和外边距*/
margin: 0;
padding: 0;
/*让边框不占宽度和高度*/
box-sizing: border-box;
width: 100%;
height: 100%;

相关开发文档

  1. vue.js 2
  2. vue.js 3
  3. element
  4. element plus
  5. ant design vue 1.7.8
  6. ant design vue 3.2.14
  7. axios
  8. echarts
  9. css

猜你喜欢

转载自blog.csdn.net/y1534414425/article/details/128797635