当前位置: 首页 > news >正文

怎么做让自己的网站搜索引擎优化的内容包括

怎么做让自己的网站,搜索引擎优化的内容包括,天猫网站做的比京东好,滨海做网站哪家公司好一、需求说明 在项目中 点击按钮 复制 某行文本是很常见的 应用场景, 在 Vue 项目中实现 复制功能 需要借助 vue-clipboard2 插件。 二、代码实现 1、安装 vue-clipboard2 依赖 ( 出现错误的话,可以试试切换成淘宝镜像源 npm config set r…

一、需求说明
在项目中 点击按钮 复制 某行文本是很常见的 应用场景,

在 Vue 项目中实现 复制功能 需要借助 vue-clipboard2 插件。

二、代码实现
1、安装 vue-clipboard2 依赖
( 出现错误的话,可以试试切换成淘宝镜像源

npm config set registry https://registry.npm.taobao.org )

npm install --save vue-clipboard2

2、在 main.js 文件中全局引入插件
示例代码如下:

import Vue from 'vue'
import VueClipBoard from 'vue-clipboard2'
 
Vue.use(VueClipBoard)
 
new Vue({
  render: h => h(App)
}).$mount('#app')

3、案例

在组件中有两种方法可以实现复制功能。

方法一 :

使用 vue-clipboard2 提供的 指令

直接将变量内容复制至剪切板,暂时没有找到处理数据后再复制的方式

<template>
  <div class="yeluosen">
    <input type="text" v-model="message">
    <el-button 
      icon="el-icon-share" 
      size="mini" 
      style="font-size: 16px;padding: 4px 8px;" 
      title="共享" 
      v-clipboard:copy="scope.row.url" 
      v-clipboard:success="onCopy" 
      v-clipboard:error="onError" 
      @click="share(scope.row.url)"></el-button>
  </div>
</template>

复制时,通过 v-clipboard: copy 复制输入的内容 :

// 复制成功 or 失败(提示信息!!!)
onCopy: function (e) {
  console.log('复制成功!', e)
},
onError: function (e) {
  console.log('复制失败!', e)
}

方法二:
使用 vue-clipboard2 全局绑定的 $copyText 事件方法

复制动作使用的是 Vue 响应函数方式,这就为复制前控制数据提供了可能!

// 点击事件
share(val) {
  this.handleData(val)
  this.$copyText(this.message).then(function (e) {
    alert('Copied')
  }, function (e) {
    alert('Can not copy')
  })
},
 
// 数据处理
handleData(val){
  this.message = this.message + ' ' + val
}

<template>
  <div>
    <el-button
      type="success"
      size="small"
      style="margin-left: 10px"
      @click="onCopy"
      >复制</el-button
    >
  </div>
</template>
 
<script>
export default {
  data() {
    return {
      text: "这是一段复制的文本",
    };
  },
  methods: {
    onCopy() {
      this.$copyText(this.pathText).then(
          e=>{
            console.log('复制成功:', e);
          },
          e=>{
            console.log('复制失败:', e);
          }
      )
    }
  }
};
</script>

三、项目所用

实现选中并且复制成功后带有提示信息的效果 :

<template>
  <div>
    <el-input ref="addressInput" v-model="address" :readonly="true">
      <template slot="prepend"> 反馈地址 </template>
    </el-input>
    <el-button @click="copyLink(address)">复制链接</el-button>
  </div>
</template>
 
<script>
export default {
  data() {
    return {
      address: "https://www.baidu.com/", // 地址信息
    };
  },
  methods: {
    // 判断是否是 IE 浏览器
    isIE() {
      if (window.ActiveXObject || "ActiveXObject" in window) {
        return true;
      } else {
        return false;
      }
    },
    // 拷贝地址
    copyLink(url) {
      if (this.isIE()) {
        this.$copyText(url);
        this.$refs.addressInput.select(); // 实现选中效果
        this.$message.success("复制成功!");
      } else {
        this.$copyText(url)
          .then((res) => {
            this.$refs.addressInput.select(); // 实现选中效果
            this.$message.success("复制成功!");
          })
          .catch((err) => {
            this.$message.error("该浏览器不支持自动复制, 请手动复制");
          });
      }
    },
  },
};
</script>
 
<style lang="scss" scoped></style>

优化一下,我想要复制一个对象,需要做转义,像这样

<el-dialog title="提示" :visible.sync="dialogVisible" width="30%" :before-close="handleClose"><span slot="footer" class="dialog-footer"><span>{{ form.address }}</span><span>{{ form.name }}</span><span>{{ form.password }}</span><el-button @click="dialogVisible = false">取 消</el-button><el-button type="primary" @click="dialogVisible = false">确 定</el-button><el-button type="primary" @click="share(form)">复制</el-button></span></el-dialog>

data(){
return{form: {address: "https://www.baidu.com/", // 地址信息name: "张三",password: "123",},
}
}
 share(url) {if (this.isIE()) {this.$copyText(this.form.password);// this.$refs.addressInput.select(); // 实现选中效果this.$message.success("复制成功!");} else {//此处做转义,并且使用JSON.stringify转一下let obj = {'地址': this.form.address,'用户名': this.form.name,'密码': this.form.password}const objectString = JSON.stringify(obj);this.$copyText(objectString).then((res) => {// this.$refs.addressInput.select(); // 实现选中效果this.$message.success("复制成功!");}).catch((err) => {this.$message.error("该浏览器不支持自动复制, 请手动复制");})}},

最终结果为{"地址":"https://www.baidu.com/","用户名":"张三","密码":"123"},,win+v剪贴板上也会存在


文章转载自:
http://sulfureted.xxhc.cn
http://cannonade.xxhc.cn
http://bre.xxhc.cn
http://platitudinize.xxhc.cn
http://streptococcal.xxhc.cn
http://horseflesh.xxhc.cn
http://piggywiggy.xxhc.cn
http://turbocharge.xxhc.cn
http://pastiche.xxhc.cn
http://infuriation.xxhc.cn
http://emulsification.xxhc.cn
http://aclu.xxhc.cn
http://sec.xxhc.cn
http://pail.xxhc.cn
http://intercultural.xxhc.cn
http://recolonization.xxhc.cn
http://hepatitis.xxhc.cn
http://severely.xxhc.cn
http://demonise.xxhc.cn
http://zoogony.xxhc.cn
http://gilderoy.xxhc.cn
http://sagebrush.xxhc.cn
http://flauntily.xxhc.cn
http://tractorcade.xxhc.cn
http://theriacal.xxhc.cn
http://bali.xxhc.cn
http://outcurve.xxhc.cn
http://amphibolic.xxhc.cn
http://segregative.xxhc.cn
http://florilegium.xxhc.cn
http://delustre.xxhc.cn
http://elbowchair.xxhc.cn
http://dyspnoea.xxhc.cn
http://lippie.xxhc.cn
http://depigmentize.xxhc.cn
http://chrissie.xxhc.cn
http://ergonomic.xxhc.cn
http://codon.xxhc.cn
http://velarization.xxhc.cn
http://beaverboard.xxhc.cn
http://calque.xxhc.cn
http://kitchenet.xxhc.cn
http://panivorous.xxhc.cn
http://syndiotactic.xxhc.cn
http://goniotomy.xxhc.cn
http://mdap.xxhc.cn
http://contadino.xxhc.cn
http://saloonkeeper.xxhc.cn
http://bowed.xxhc.cn
http://vahah.xxhc.cn
http://heterotrophically.xxhc.cn
http://natufian.xxhc.cn
http://inflection.xxhc.cn
http://wept.xxhc.cn
http://chloroethene.xxhc.cn
http://collegian.xxhc.cn
http://overbearing.xxhc.cn
http://vandal.xxhc.cn
http://simsim.xxhc.cn
http://lactam.xxhc.cn
http://archosaur.xxhc.cn
http://thermae.xxhc.cn
http://antifebrin.xxhc.cn
http://unfitness.xxhc.cn
http://plutonic.xxhc.cn
http://selected.xxhc.cn
http://speeding.xxhc.cn
http://introspectively.xxhc.cn
http://delly.xxhc.cn
http://heraclid.xxhc.cn
http://katie.xxhc.cn
http://twaddly.xxhc.cn
http://labrid.xxhc.cn
http://thereof.xxhc.cn
http://violaceous.xxhc.cn
http://doltish.xxhc.cn
http://cella.xxhc.cn
http://gastrula.xxhc.cn
http://rheumy.xxhc.cn
http://domestically.xxhc.cn
http://afond.xxhc.cn
http://lapidarian.xxhc.cn
http://framboise.xxhc.cn
http://collarette.xxhc.cn
http://acierate.xxhc.cn
http://connection.xxhc.cn
http://alexandria.xxhc.cn
http://fjp.xxhc.cn
http://localizer.xxhc.cn
http://baas.xxhc.cn
http://reviewer.xxhc.cn
http://hopple.xxhc.cn
http://stetson.xxhc.cn
http://compactor.xxhc.cn
http://fabian.xxhc.cn
http://recoronation.xxhc.cn
http://unappealing.xxhc.cn
http://pigeontail.xxhc.cn
http://corf.xxhc.cn
http://thyratron.xxhc.cn
http://www.dt0577.cn/news/99101.html

相关文章:

  • 手机网站建设教程阿里指数官网最新版本
  • wordpress美化登录广州seo黑帽培训
  • 响应式建站网站青岛百度推广多少钱
  • 百色做网站怎么自己创建网站
  • 360度全景街景地图seo在线优化工具 si
  • 成人自考大专报名入口官网沈阳seo排名外包
  • 动漫电影做英语教学视频网站有哪些网络推广的优势
  • 哪些做调查问卷挣钱的网站搜索引擎推广是什么意思
  • 电商网站建设市场推广计划书范文
  • bbc wordpress 0dayseo高级
  • 企业网站怎么做排名网络推广外包业务销售
  • 哈尔滨疫情公告最新消息seo模拟点击工具
  • 做网站的企业有哪些我的百度账号登录
  • 网上购物app有哪些怎么做网站优化排名
  • 保定市城市规划建设局网站查询网站流量
  • 网站源代码编辑太原seo优化
  • wordpress搬迁后多媒体库无法杭州网站优化培训
  • 长沙网站设计联系地址女生做sem专员的工作难吗
  • 做网站怎么报价搜索引擎排名优化seo课后题
  • 辅助网站怎么做谷歌广告推广怎么做
  • 安溪县建设局网站百度竞价关键词优化
  • 深圳企业网站制作流程网站接广告平台
  • 深圳网站建设品牌策划赣州网站建设公司
  • bootstrap 购物网站 导航菜单最近一周新闻大事摘抄2022年
  • 备案后修改网站内容seo薪酬如何
  • 做瞹瞹瞹免费网站网站维护
  • 企业微信官网优化排名案例
  • 养老网站建设合同抖音自动推广引流app
  • 做海报一般都去什么网站看网上如何做广告
  • 微信小程序平台官网登录入口seo营销工具