随笔分类 -  Vue笔记

摘要:父组件: <template> <el-button type="primary" plain @click="Newlyadded('addOrder')">新增</el-button> <Add ref="addOrder" v-if="addOrderVisible" :visible.syn 阅读全文
posted @ 2021-09-01 17:51 病阳阳 阅读(254) 评论(0) 推荐(0)
摘要:getNowTime() { var date = new Date(); year = date.getFullYear(); month = date.getMonth() + 1; var monthStr = month >= 10 ? month : "0" + month; day = 阅读全文
posted @ 2021-08-18 17:00 病阳阳 阅读(185) 评论(0) 推荐(0)
摘要:seeShare(){ let routeUrl = this.$router.resolve({ path: "/share", query: {id:96} }); //let routeUrl = this.$router.resolve(`/share/${96}`) window.open 阅读全文
posted @ 2021-08-18 11:30 病阳阳 阅读(92) 评论(0) 推荐(0)
摘要:创建路由文件 在项目的`src`目录下,创建`router.js`文件,用来专门管理路由,接下来所有的路由都写在这个文件中。 1.在router.js中导入vue-router import Vue from "vue";import VueRouter from "vue-router";Vue. 阅读全文
posted @ 2020-12-04 14:20 病阳阳 阅读(145) 评论(0) 推荐(0)
摘要:注册全局自定义指令 `v-focus` Vue.directive('focus', { // 当被绑定的元素插入到 DOM 中时…… inserted: function (el) { // 聚焦元素 el.focus() }}) 注册局部指令(directives ) directives: { 阅读全文
posted @ 2020-12-03 12:04 病阳阳 阅读(40) 评论(0) 推荐(0)
摘要:注册局部组件 1 引入组件import Users from './components/Users.vue'import Header from './components/Header.vue'import Footer from './components/Footer.vue'export 阅读全文
posted @ 2020-12-02 16:44 病阳阳 阅读(141) 评论(0) 推荐(0)
摘要:component: () => import() //需要babel插件 否则import报错 const App = () => import('../component/Login.vue'); 阅读全文
posted @ 2020-12-02 16:39 病阳阳 阅读(83) 评论(0) 推荐(0)
摘要:Vue项目中常用的生命周期和参数 <script> import Confin from '@/components/sub/Confin'; export default { name: 'Fist', components: {Confin}, //注册组件,比如要插入另外一个写好的VUE文件买 阅读全文
posted @ 2020-12-02 16:38 病阳阳 阅读(126) 评论(0) 推荐(0)
摘要:1.创建如下图中的文件夹和文件 2.在 Loading.vue 中定义一个组件 <template> <div class="loading-box"> Loading... </div> </template> 3.在 index.js 中 引入 Loading.vue ,并导出 // 引入组件 阅读全文
posted @ 2020-12-01 15:33 病阳阳 阅读(168) 评论(0) 推荐(0)