小编Sye*_*yed的帖子

CSS3变换歪斜一面

是否有可能创建"CSS3 Transform Skew One Side"

我找到了一个解决方案,但它对我没用,因为我需要使用图像作为背景(而不是颜色)

#skewOneSide {
    border-bottom: 40px solid #FF0000;
    border-left: 50px solid rgba(0, 0, 0, 0);
    height: 0;
    line-height: 40px;
    width: 100px;
}
Run Code Online (Sandbox Code Playgroud)

即使这个JsFiddle没用(倾斜的区域应该是透明的)

css html5 css3 css-shapes

27
推荐指数
5
解决办法
10万
查看次数

如何禁用vue.js <template>中段落的eslint规则最大行长度?

我正在使用airbnb eslint,目前我收到错误:

错误:第6行超过路径/到/ file.vue的最大行长度100(max-len):6:1:

<template lang="pug">
  div
    .container
      .row
        .col-xl-10.mx-auto
          p Please let us know how you got here, and use the header buttons to navigate back to safe harbor.
</template>
Run Code Online (Sandbox Code Playgroud)

有没有办法禁用上面的段落文本的lint?
另外,如何将线路长度从100增加到120?

javascript eslint vue.js airbnb-js-styleguide vuejs2

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

在子项vueJS.2之间切换"活动"类

我只是想知道怎么做vue.js方式,现在我能够active在单项上切换课程,当我点击其他项目时,该active课程仍然出现在上一项目中,这是我的设置:

FileOne.vue(父组件)

// Say that I have 5 Items I am rendering here:
<template>
  <ul v-for="item in items">
    <my-list-item :item-title="article.title"
                  :item-content="article.content"> </my-list-item>
  </ul>
</template>

<script>
  import Items from './FileTwo'
  export default {}
</script>
Run Code Online (Sandbox Code Playgroud)

fileTwo.vue(子组件)

// When I click each Item the `active` class should be applied to the current Item and removed from previous item:
<template>
  <li :class="{'active': isRowActive}" @click.stop="toggleRowActive">
    <h1>{{articleTitle}}</h1>
    <p>{{itemContent}}</p>
  </li>
</template>

<script>  
  export default {
    name: 'my-list-item',
    data: function () {
      return { …
Run Code Online (Sandbox Code Playgroud)

vue.js vuejs2

9
推荐指数
2
解决办法
9699
查看次数

在控制台中解决[Violation]警告时滚动DIV时阻止页面滚动

起初这似乎是在这里回答的重复问题,但还有更多需要弄清楚.

如何[Violation]在Google Chrome控制台中解决以下警告问题?

[违规]为滚动阻止"鼠标滚轮"事件添加了非被动事件监听器.考虑将事件处理程序标记为"被动"以使页面更具响应性.

这是有效的代码片段,但有上述[Violation]警告.

$.fn.isolatedScroll = function() {
  this.on('mousewheel DOMMouseScroll', function (e) {
    let delta = e.wheelDelta || (e.originalEvent && e.originalEvent.wheelDelta) || -e.detail,
      bottomOverflow = this.scrollTop + $(this).outerHeight() - this.scrollHeight >= 0,
      topOverflow = this.scrollTop <= 0;

    if ((delta < 0 && bottomOverflow) || (delta > 0 && topOverflow)) {
      e.preventDefault();
    }
  });
  return this;
};

$('.js-isolated-scroll').isolatedScroll()

// Nothing to check here as it's just repeating <p> tags
function multiplyNode(node, count, …
Run Code Online (Sandbox Code Playgroud)

javascript jquery css3 modernizr passive-event-listeners

9
推荐指数
1
解决办法
925
查看次数

使用CRUD设置激活具有多级嵌套路由的路由器链接

我想安装深度嵌套像下面,我有点不确定,我们不能用exactrouter-link嵌套的路线.

<div id="app">
  <nav class="nav nav-main">
    <router-link exact to="/" class="nav-link" activeClass="active">Dashboard</router-link>
    <router-link to="/projects" class="nav-link" activeClass="active">Projects</router-link>
  </nav>

  <div class="parent-content">
    <h4>Content for Parent goes here</h4>
  </div>

  <router-view>
    <nav class="nav nav-main">
      <router-link :to="'/projects/' + $route.params.projectId" class="nav-link" activeClass="active">Deals</router-link>
      <router-link :to="'/projects/' + $route.params.projectId + '/commitments/'" class="nav-link" activeClass="active">Commitments</router-link>
    </nav>
    <router-view>
      <div class="child-content">
        <h4>Content for Child goes here</h4>
      </div>
    </router-view>
  </router-view>
</div>
Run Code Online (Sandbox Code Playgroud)

我的路线:

routes: [
  {
    path: '/',
    component: Dashboard
  },
  {
    path: '/projects',
    component: Projects
  },
  {
    path: '/projects/:id',
    name: 'projects-detail',
    component: …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vue-router

9
推荐指数
1
解决办法
2894
查看次数

如何使用 vue.js/nuxt.js 获取目录中的所有图像文件

我正在处理一个 nuxt.js 项目并出现错误:

在浏览器中,我看到此错误:

__webpack_require__(...).context is not a function
Run Code Online (Sandbox Code Playgroud)

而且,在终端中,我收到此错误:

Critical dependency: require function is used in a way in which dependencies cannot be statically extracted 
Run Code Online (Sandbox Code Playgroud)

这是我的代码

<script>
export default {
  name: 'SectionOurClients',
  data() {
    return {
      imageDir: '../assets/images/clients/',
      images: {},
    };
  },

  mounted() {
    this.importAll(require.context(this.imageDir, true, /\.png$/));
  },

  methods: {
    importAll(r) {
      console.log(r)
    },
  },
};
</script>
Run Code Online (Sandbox Code Playgroud)

我从HERE使用了上面的脚本。

请帮忙,谢谢。


编辑:按照@MaxSinev 的回答后,这是我的工作代码的样子:

<template lang="pug">
  .row
    .col(v-for="client in images")
      img(:src="client.pathLong")
</template>

<script>
export default {
  name: 'SectionOurClients',
  data() …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vuejs2 nuxt.js

9
推荐指数
2
解决办法
7014
查看次数

如何在具有不同命名空间的情况下访问具有相似名称的 vue/vuex mapActions 方法?

这工作得很好。

created() {
  this['shared/getPosts']();
  this['posts/getPosts']();

},

methods: {
  ...mapActions(['shared/getPosts', 'posts/getPosts']),
},
Run Code Online (Sandbox Code Playgroud)

但是,我想知道,有没有办法让下面的代码按预期工作,请参考评论:

created() {
  this.getPosts(); // triggers last method
},

methods: {
  ...mapActions('shared', ['getPosts']), // how to trigger this?
  ...mapActions('posts', ['getPosts']), // this gets triggered.
},
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vuex

8
推荐指数
1
解决办法
2785
查看次数

Vite磁盘缓存问题

我有一个使用vitevue 3作为前端的项目。它还使用eslint. 有时,当我运行代码时,它会抛出如下错误:

\n

投票错误信息

\n

2:26:53 PM [vite] Internal server error: /path/to/project/wt-frontend-2/src/pages/school-districts/PageSsDetails.vue
\n46:1 error "@/assets/images/school.svg" import should occur before import of "./components/SdDoughnutChart.vue" import/order

\n

\xe2\x9c\x96 1 problem (1 error, 0 warnings)
\n 1 error and 0 warnings potentially fixable with the "--fix" option.

\n

Plugin: vite:eslint
\n File: /path/to/project/wt-frontend-2/src/pages/school-districts/PageSsDetails.vue

\n

at formatError (/path/to/project/wt-frontend-2/node_modules/vite/dist/node/chunks/dep-76613303.js:36769:46)\n at TransformContext.error (/path/to/project/wt-frontend-2/node_modules/vite/dist/node/chunks/dep-76613303.js:36765:19)\n at TransformContext.transform (/path/to/project/wt-frontend-2/node_modules/vite-plugin-eslint/dist/index.js:87:14)\nat processTicksAndRejections (internal/process/task_queues.js:95:5) \nat async Object.transform (/path/to/project/wt-frontend-2/node_modules/vite/dist/node/chunks/dep-76613303.js:36985:30)

\n

但是,一旦我修复代码并保存,它就不会检测到更新的文件。(不过它确实会自动运行)。

\n …

javascript vue.js rollupjs vuejs3 vite

8
推荐指数
1
解决办法
6544
查看次数

auto_explain_threshold_in_seconds

运行WEBrick时,我收到的信息低于给定的消息.

auto_explain_threshold_in_seconds已设置但将被忽略,因为您的适配器不支持此功能.请取消配置以避免此警告.

我在用:

宝石'轨道','3.2.13'
宝石'mysql'

WEBrick 1.3.1
ruby 1.9.3(2013-02-22)[i386-mingw32]

有人可以帮助我知道 - 为什么我得到这个以及如何解决它?

ruby-on-rails

7
推荐指数
2
解决办法
4369
查看次数

如何动态添加或删除 Vue.js 组件(以编程方式或即时)

这是我的代码,这只是一个示例代码,如果下面的代码有效,那么这将帮助我构建我正在处理的其他内容。

<template>
  <div id="wrapper">
    <div id="divOne">
      <!-- Add or remove component here dynamically -->
    </div>
    <div id="divTwo">
      <!-- Add or remove component here dynamically -->
    </div>

    <!-- There will be more divs like #divOne #divTwo above -->

    <div>
      <input type="radio" id="one" value="divOne" v-model="pickedDiv">
      <label for="one">One</label>
    </div>
    <div>
      <input type="radio" id="two" value="divTwo" v-model="pickedDiv">
      <label for="two">Two</label>
    </div>

    <button @click="addComponent">Add Component</button>
  </div>
</template>

<script>
import SomeComponent from './SomeComponent'

export default {
  data() {
    return {
      pickedDiv: '',
      pickedDivPreviously: ''
      propItems: ['item1', 'item2']
    } …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vue-component vuejs2

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