123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- // 统计数据
- // 统计类型 1:首页banner;2:直播模块;3:最新活动;4:热门文章;5:新品橱窗;6:活动列表
- import Vue from 'vue'
- const searchMixins = {
- computed: {
- },
- methods: {
- sliceStr(str, len) {
- var len = len || 8
- if (str != null) {
- if (str.length > len) {
- return str.substring(0, len) + '...'
- } else {
- return str
- }
- }
- return ''
- },
- isInterceptHtmlFn(text) {
- let name = this.$reg.interceptHtmlFn(text)
- return name
- },
- handeleCeptText(content, key, res) {
- if (res == undefined) {
- res = []
- }
- key = key.toUpperCase()
- let keyLen = key.length
- let tmp = content.toUpperCase()
- if (tmp.length >= keyLen && keyLen > 0) {
- let index = -1
- index = tmp.indexOf(key)
- if (index != -1) {
- let n = content.substring(0, index)
- res.push({
- type: 2,
- text: n
- })
- let y = content.substring(index, index + keyLen)
- res.push({
- type: 1,
- text: y
- })
- content = content.substring(index + keyLen, content.length)
- this.handeleCeptText(content, key, res)
- } else {
- res.push({
- type: 2,
- text: content
- })
- }
- } else {
- res.push({
- type: 2,
- text: content
- })
- }
- return res
- },
- myReplace(content) {
- content = content.replace(' ', ' ')
- if (content.indexOf(' ') != -1) {
- return myReplace(content)
- }
- return content
- }
- }
- }
- export default searchMixins
|