小编kan*_*ano的帖子

Vuejs - 如何在元素上的加载事件上调用方法

我想在使用 vuejs 将元素加载到 for 循环中时调用元素上的加载事件。我在页面加载时发现了 onload 事件,但无论如何我都找不到使用元素来做到这一点。这是我的代码,但它不起作用。

<ul>
  <li v-for="(option,opt_index) in question.options" v-on:load="test">
  Testing
  </li>
</ul>
Run Code Online (Sandbox Code Playgroud)

这是我的组件。

import VueSweetalert2 from 'vue-sweetalert2';

Vue.use(datePicker);
Vue.use(VueSweetalert2);
Vue.use(VeeValidate);

export default {
    name: "modal",
    components: {
        draggable,
    },
    mounted() {
    },
    methods: {
        test(){
            alert('load');
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

javascript dom-events vue.js

6
推荐指数
1
解决办法
1万
查看次数

使用预设 Dockerize ESLint

我正在尝试创建一个 GitLab CI/CD 阶段,它只会检查我的代码并在所有其他步骤之前运行。问题是,出于速度优化的原因,我试图在预构建的图像上进行 linting(及其配置)。

我的.gitlab-ci.yml

stages:
  - prelint
  - lint
  - build
  - deploy

build-linter:
  stage: prelint
  script: echo 'This builds the linter image'
  only:
    changes:
      - Dockerfile.lint

lint:
  stage: lint
  image: prebuilt-linter
  script:
    - npm run lint
Run Code Online (Sandbox Code Playgroud)

以及内容Dockerfile.lint

FROM node:lts-alpine

RUN npm i -g eslint \
  prettier \
  @babel/core \
  core-js \
  core-js-compat@3.4.7 \
  eslint-config-prettier \
  eslint-plugin-prettier \
  eslint-plugin-vue \
  @vue/cli-service \
  @vue/cli-plugin-eslint \
  @vue/cli-plugin-babel \
  @vue/cli-plugin-unit-jest \
  @vue/cli-plugin-e2e-nightwatch \
  @vue/eslint-config-prettier \
  babel-eslint

WORKDIR /app …
Run Code Online (Sandbox Code Playgroud)

npm gitlab docker eslint vue-cli

6
推荐指数
0
解决办法
1582
查看次数

标签 统计

docker ×1

dom-events ×1

eslint ×1

gitlab ×1

javascript ×1

npm ×1

vue-cli ×1

vue.js ×1