日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > vue >内容正文

vue

VueJS项目

發布時間:2025/3/11 vue 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 VueJS项目 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

VueJS項目 - awesome-vue

vue-cli引用jquery, bootstrap, bootstrap-table

  • 引用jquery
    找到vue-project/build/webpack.base.conf.js文件,在module.exports下添加plugins,
    需要在之前,引用webpack,

    var webpack = require('webpack');

    參考

    plugins: [new webpack.optimize.CommonsChunkPlugin('common.js'),new webpack.ProvidePlugin({jQuery: "jquery",$: "jquery"})]
  • 引用bootstrap
    在main.js中引用

    import ‘./assets/libs/bootstrap/css/bootstrap.min.css’
    import ‘./assets/libs/bootstrap/js/bootstrap.min’

    前提是你引用了jquery,不然會報錯

    import $ from ‘jquery’

  • 引用bootstrap-table

    • 未實現,后期學習 vuetable-2

vue生成dist目錄不能運行

修改vue-project/config/index.js中的

module.exports = {build: {assetsPublicPath: './'}

vue snippet for sublime text

<snippet><content><![CDATA[ <template>${1} </template><script>export default {data () {return {}} } </script><style scoped></style> ]]></content><!-- Optional: Set a tabTrigger to define how to trigger the snippet --><tabTrigger>vue</tabTrigger><!-- Optional: Set a scope to limit where the snippet will trigger --><!-- <scope>Text.vue</scope> --> </snippet>

vue引用font-awesome

[font-awesome官網](http://fontawesome.io/icons/) 相關文件解析時會報錯,是否需要配置? 可以通過vue-cli來引用[vue-awesome](https://www.npmjs.com/package/vue-awesome) ``` import Vue from 'vue'/* Pick one way between the 2 following ways */// only import the icons you use to reduce bundle size import 'vue-awesome/icons/flag'// or import all icons if you don't care about bundle size import 'vue-awesome/icons'/* Register component with one of 2 methods */import Icon from 'vue-awesome/components/Icon'// globally (in your main .js file) Vue.component('icon', Icon)// or locally (in your component file) export default {components: {Icon} } ``` 在html中使用 ``` <!-- basic --> <icon name="beer"></icon><!-- with options --> <icon name="refresh" scale="2" spin></icon> <icon name="comment" flip="horizontal"></icon> <icon name="code-fork" label="Forked Repository"></icon><!-- stacked icons --> <icon label="No Photos"><icon name="camera"></icon><icon name="ban" scale="2" class="alert"></icon> </icon> ``` <link rel="icon" href="/favicon.ico" type="image/x-icon" />
  • vue-router生成路由
  • vue下transition和javascript鉤子
    css類:
    v-enter, v-enter-active, v-leave, v-leave-active
    javascript鉤子
<transitionv-on:before-enter="beforeEnter"v-on:enter="enter"v-on:after-enter="afterEnter"v-on:enter-cancelled="enterCancelled"v-on:before-leave="beforeLeave"v-on:leave="leave"v-on:after-leave="afterLeave"v-on:leave-cancelled="leaveCancelled" ><!-- ... --> </transition>

注意ES6風格的語法IE9不支持,以下是ES5語法:

methods: {// --------// 進入中// --------beforeEnter: function (el) {// ...},// 此回調函數是可選項的設置// 與 CSS 結合時使用enter: function (el, done) {// ...done()},afterEnter: function (el) {// ...},enterCancelled: function (el) {// ...},// --------// 離開時// --------beforeLeave: function (el) {// ...},// 此回調函數是可選項的設置// 與 CSS 結合時使用leave: function (el, done) {// ...done()},afterLeave: function (el) {// ...},// leaveCancelled 只用于 v-show 中leaveCancelled: function (el) {// ...} }

IE9對于ES6不兼容

箭頭函數不支持: () => {} 修改為: function() {}
省略函數字段不支持 created () {} 修改為: created: function(){}

vue-cli對于bootstrap-table適配性不好

v-for的item綁定到v-model會失效

<div id="editor"><input v-for="item in arr" v-model="item"/> </div> new Vue({el: '#editor',data: {input: '# hello',in1: '1',arr: ["in1", "in2", "in3", "in3"]} })

無法通過item的值對于元素的model進行控制

總結

以上是生活随笔為你收集整理的VueJS项目的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。