<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 標簽編輯 考慮編程實現以下功能: > 在界面設計中設計標簽編輯組件需要一次性錄入多個標簽,但是手工錄入或者導入的數據可能不一致,需要進行容錯設計。 * [ ] 批量添加(編輯)標簽Tags,兩個標簽之間使用分隔符分隔,系統轉換為數組。 * [ ] 支持多種分隔符號,例如英文和中文的逗號,分號,|等都要兼容(容錯) * [ ] 多次輸入的數據拼接成一個數組。 測試數據:計算機,電腦,,程序;數據;| 測試 以上解析為:計算機,電腦,程序數據,測試 # 參考設計 * [ ] 根據給定的字符串解析標簽數組 * [ ] 合并兩個標簽數組 * [ ] 去重 使用的效果如圖所示: ![](https://box.kancloud.cn/4561cdd87f9af5bc057b41516e6e86a6_406x108.png) ``` <template> <view class="tagController"> <view class="tagContainer"> <view :class="computedClass" :key="index" v-for="(tagText,index) in tagList"> <text @tap="tapTag" :data-text="tagText">{{tagText}}</text> <text v-if="isShowDelIcon" class="tagDelIcon" @tap="delTag" :data-text="tagText">x</text> </view> <view class="tagInput" v-if="isShowAdd"> <input type="text" v-model="tagString" placeholder="新增標簽(組)" @blur="createTags" :class="computedClass" /> </view> </view> </view> </template> <script> export default { name: 'ts-tags', model: { prop: 'value', event: 'input' }, props: { enableDel: { type: [Boolean], defalut: false }, enableAdd: { type: [Boolean], defalut: false }, value: { type: [Array, String], defalut() { return [] } }, size: { //標簽大小 normal, small, large type: String, default: 'small' }, type: { //標簽類型default、primary、success、warning、error type: String, default: 'default' }, disabled: { //是否為禁用狀態 type: [String, Boolean], defalut: false }, inverted: { //是否為空心 type: [String, Boolean], defalut: false }, circle: { //是否為圓角 type: [String, Boolean], defalut: false }, dashed: { //是否為虛線框 type: [String, Boolean], defalut: false }, mark: { //是否為標記樣式 type: [String, Boolean], defalut: false } }, data() { return { tagString: '', tagList: (typeof(this.value) === 'string' ? this.value.split(',') : this.value) || [], isShowDelIcon: this.enableDel || false, isShowAdd: this.enableAdd || false, } }, created() { }, watch: { value(newValue, oldValue) { if (typeof(newValue) === 'string') { this.tagList = newValue.split(',') } this.tagList = newValue || []; } }, computed: { computedClass() { let classArr = ['ts-tag']; if (this.disabled === true || this.disabled === 'true') { classArr.push('ts-tag--disabled'); } if (this.inverted === true || this.inverted === 'true') { classArr.push('ts-tag--inverted'); } if (this.circle === true || this.circle === 'true') { classArr.push('ts-tag--circle'); } if (this.mark === true || this.mark === 'true') { classArr.push('ts-tag--mark'); } if (this.dashed === true || this.dashed === 'true') { classArr.push('ts-tag--dashed'); } classArr.push('ts-tag--' + this.size); classArr.push('ts-tag--' + this.type); // console.log(classArr); return classArr; }, }, methods: { createTags: function() { let tempTagArr = [] if (this.tagString.length > 0) { let newTagList = this.tagString.split(/,|,|;|;/) for (let i = 0; i < newTagList.length; i++) { let newTag = newTagList[i].trim() if (newTag !== '' && this.tagList.indexOf(newTag) < 0) { tempTagArr.push(newTag) } } } this.tagString = '' this.tagList.splice(this.tagList.length, 0, ...tempTagArr) this.$emit('add', { currentTag: tempTagArr, allTags: this.tagList }) // console.log(this.value); this.$emit('input', this.tagList) }, delTag: function(e) { let delTagText = e.currentTarget.dataset.text let delTagIndex = this.tagList.indexOf(delTagText) this.tagList.splice(delTagIndex, 1) this.$emit("delete", { currentTag: delTagText, allTags: this.tagList }) this.$emit('input', this.tagList) }, tapTag: function(e) { let selTagText = e.currentTarget.dataset.text this.$emit("click", selTagText) } } } </script> <style lang="scss" scoped> @import '../../variables.scss'; $tag-pd:0upx 10upx; $tag-small-pd:0upx 5upx; .tagController { padding: 10upx 0upx; display: flex; flex-direction: column; } .tagContainer { display: flex; flex-wrap: wrap; justify-content: flex-start; } .tagDelIcon { padding-left: 20upx; } .tagInput {} .tagInput input { width: 200upx; } @mixin tag-disabled { opacity: 0.5; } .ts-tag { box-sizing: border-box; justify-content: center; align-items: center; padding: $tag-pd; margin: 5upx; background-color: $uni-bg-color-grey; border: 1upx solid $uni-bg-color-grey; color: $uni-text-color; font-size: $uni-font-size-base; border-radius: $uni-border-radius-base; font-weight: normal; &--circle { border-radius: 20upx; } &--mark { border-radius: 0 30upx 30upx 0 } &--dashed { border: 1upx dashed; } &--disabled { @include tag-disabled; } &--normal {} &--mini { padding: $tag-small-pd; font-size: $ts-font-size-xs; } &--small { padding: $tag-small-pd; font-size: $uni-font-size-sm; } &--large { padding: $tag-pd; font-size: $uni-font-size-lg; } &--default {} &--primary { color: $uni-text-color-inverse; background-color: $uni-color-primary; border: 1upx solid $uni-color-primary; &.ts-tag--inverted { color: $uni-color-primary; background-color: $uni-bg-color; border: 1upx solid $uni-color-primary; } } &--success { color: $uni-text-color-inverse; background-color: $uni-color-success; border: 1upx solid $uni-color-success; &.ts-tag--inverted { color: $uni-color-success; background-color: $uni-bg-color; border: 1px solid $uni-color-success; } &.ts-tag--dashed { border: 1upx dashed; } } &--warning { color: $uni-text-color-inverse; background-color: $uni-color-warning; border: 1upx solid $uni-color-warning; &.ts-tag--inverted { color: $uni-color-warning; background-color: $uni-bg-color; border: 1upx solid $uni-color-warning; } &.ts-tag--dashed { border: 1upx dashed; } } &--error { color: $uni-text-color-inverse; background-color: $uni-color-error; border: 1upx solid $uni-color-error; &.ts-tag--inverted { color: $uni-color-error; background-color: $uni-bg-color; border: 1upx solid $uni-color-error; } &.ts-tag--dashed { border: 1upx dashed; } } &--inverted { color: $uni-text-color; background-color: $uni-bg-color; border: 1upx solid $uni-bg-color-grey; } } </style> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看